Annotation of Gnu-Mach/i386/util/gdt.h, revision 1.1.1.1

1.1       root        1: /* 
                      2:  * Copyright (c) 1995-1994 The University of Utah and
                      3:  * the Computer Systems Laboratory at the University of Utah (CSL).
                      4:  * All rights reserved.
                      5:  *
                      6:  * Permission to use, copy, modify and distribute this software is hereby
                      7:  * granted provided that (1) source code retains these copyright, permission,
                      8:  * and disclaimer notices, and (2) redistributions including binaries
                      9:  * reproduce the notices in supporting documentation, and (3) all advertising
                     10:  * materials mentioning features or use of this software display the following
                     11:  * acknowledgement: ``This product includes software developed by the
                     12:  * Computer Systems Laboratory at the University of Utah.''
                     13:  *
                     14:  * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
                     15:  * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
                     16:  * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     17:  *
                     18:  * CSL requests users of this software to return to [email protected] any
                     19:  * improvements that they make and grant CSL redistribution rights.
                     20:  *
                     21:  *      Author: Bryan Ford, University of Utah CSL
                     22:  */
                     23: #ifndef _I386_GDT_
                     24: #define _I386_GDT_
                     25: 
                     26: #include <mach/machine/seg.h>
                     27: 
                     28: /*
                     29:  * Collect and define the GDT segment selectors.
                     30:  * xxx_IDX is the index number of the selector;
                     31:  * xxx is the actual selector value (index * 8).
                     32:  */
                     33: enum gdt_idx
                     34: {
                     35:        GDT_NULL_IDX = 0,
                     36: 
                     37: #define gdt_sel(name) name##_IDX,
                     38: #include "gdt_sels.h"
                     39: #undef gdt_sel
                     40: 
                     41:        GDT_FIRST_FREE_IDX
                     42: };
                     43: 
                     44: enum gdt_sel
                     45: {
                     46:        GDT_NULL = 0,
                     47: 
                     48: #define gdt_sel(name) name = name##_IDX * 8,
                     49: #include "gdt_sels.h"
                     50: #undef gdt_sel
                     51: };
                     52: 
                     53: #define GDTSZ GDT_FIRST_FREE_IDX
                     54: 
                     55: 
                     56: /* If we have a KERNEL_TSS, use that as our DEFAULT_TSS if none is defined yet.
                     57:    (The DEFAULT_TSS gets loaded by cpu_tables_load() upon switching to pmode.)
                     58:    Similarly with DEFAULT_LDT.  */
                     59: #if defined(ENABLE_KERNEL_TSS) && !defined(DEFAULT_TSS)
                     60: #define DEFAULT_TSS    KERNEL_TSS
                     61: #define DEFAULT_TSS_IDX        KERNEL_TSS_IDX
                     62: #endif
                     63: #if defined(ENABLE_KERNEL_LDT) && !defined(DEFAULT_LDT)
                     64: #define DEFAULT_LDT    KERNEL_LDT
                     65: #define DEFAULT_LDT_IDX        KERNEL_LDT_IDX
                     66: #endif
                     67: 
                     68: 
                     69: /* Fill a segment descriptor in a CPU's GDT.  */
                     70: #define fill_gdt_descriptor(cpu, segment, base, limit, access, sizebits) \
                     71:        fill_descriptor(&(cpu)->tables.gdt[segment/8],                  \
                     72:                        base, limit, access, sizebits)
                     73: 
                     74: #define i16_fill_gdt_descriptor(cpu, segment, base, limit, access, sizebits) \
                     75:        i16_fill_descriptor(&(cpu)->tables.gdt[segment/8],              \
                     76:                            base, limit, access, sizebits)
                     77: 
                     78: 
                     79: /* This automatically defines GDT descriptor initialization functions.  */
                     80: #define gdt_desc_initializer(segment, base, limit, access, sizebits)   \
                     81:        void cpu_gdt_init_##segment(struct cpu *cpu)                    \
                     82:        {                                                               \
                     83:                fill_gdt_descriptor(cpu, segment, base, limit,          \
                     84:                                    access, sizebits);                  \
                     85:        }
                     86: 
                     87: 
                     88: #endif _I386_GDT_

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.