diff options
author | Roland McGrath <roland@gnu.org> | 2002-10-04 02:44:53 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-06-17 23:50:18 +0200 |
commit | dcfb4c4769af83fc9877d7be93e11b8b90cb41d7 (patch) | |
tree | a9e101ac1df7efb0309ccdaaa480f7d746957e1b | |
parent | aacadf09d69500c554def326ce2a57563ff1e851 (diff) |
2002-10-03 Roland McGrath <roland@frob.com>
* i386/include/mach/i386/mach_i386.defs (i386_set_gdt, i386_get_gdt):
New routines.
* i386/i386/user_ldt.c (i386_set_gdt, i386_get_gdt): New functions.
* i386/i386/gdt.h (USER_GDT, USER_GDT_SLOTS): New macros.
* i386/i386/thread.h (struct i386_machine_state): New member user_gdt.
* i386/i386/pcb.c (switch_ktss): Copy those slots into the GDT.
* i386/i386/gdt.h (KERNEL_CS, KERNEL_DS, KERNEL_TSS, KERNEL_LDT):
Values changed, new GDT layout not matching oskit base_gdt.h defaults.
(BASE_KERNEL_CS, BASE_KERNEL_DS): New macros with to oskit's values.
* oskit/x86/main.c (ktss): Variable moved to gdt.c.
(main): Don't diddle the tss here.
* i386/i386/gdt.c (gdt_init): Do it here instead.
* oskit/x86/main.c (my_exit): Restore oskit's base_gdt.
* i386/i386/gdt.h (USER_TSS): Macro removed (was unused).
(KERNEL_GS): Macro removed (value was bogus!--fix SMP later).
* i386/i386/i386asm.sym: Comment out KERNEL_GS.
-rw-r--r-- | i386/i386/gdt.h | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/i386/i386/gdt.h b/i386/i386/gdt.h index 16a465f9..92f291af 100644 --- a/i386/i386/gdt.h +++ b/i386/i386/gdt.h @@ -35,15 +35,57 @@ #include <oskit/x86/base_gdt.h> +/* The layout of the GDT is as follows. Each four entries fill one cache line. + We need to match the oskit layout if we call into any oskit code that uses + the literal selectors. I don't think we do, except for base_gdt_load + itself. So we make sure the oskit's KERNEL_CS and KERNEL_DS selectors work + ok, but reuse the other base_gdt slots differently. It's presumed a Good + Thing to have all the commonly-used kernel-mode descriptors on one cache + line and all the user-mode descriptors on another single cache line. + + idx sel what oskit base_gdt usage + + 0 0x00 reserved (null selector) + 1 0x08 initial TSS oskit BASE_TSS + 2 0x10 initial kernel code oskit KERNEL_CS + 3 0x18 initial kernel data oskit KERNEL_DS + + 4 0x20 KERNEL_CS oskit KERNEL_16_CS + 5 0x28 KERNEL_DS oskit KERNEL_16_CS + 6 0x30 KERNEL_TSS oskit LINEAR_CS + 7 0x38 KERNEL_LDT oskit LINEAR_DS + + 8 0x43 user-mode code oskit USER_CS + 9 0x4b user-mode code oskit USER_DS + 10 0x50 i386_set_gdt #1 + 11 0x58 i386_set_gdt #2 + + 12 0x60 USER_LDT + 13 0x68 + 14 0x70 FPE_CS + 15 0x78 USER_FPREGS + + For more, can no longer use oskit base_gdt defn since GDTSZ is 16 entries. +*/ + +#define BASE_KERNEL_CS 0x10 /* <oskit/x86/base_gdt.h> value of KERNEL_CS */ +#define BASE_KERNEL_DS 0x18 /* <oskit/x86/base_gdt.h> value of KERNEL_DS */ +#undef KERNEL_CS +#undef KERNEL_DS + +#define KERNEL_CS 0x20 +#define KERNEL_DS 0x28 +#define KERNEL_TSS 0x30 +#define KERNEL_LDT 0x38 + #undef USER_CS #undef USER_DS -#define KERNEL_TSS BASE_TSS -#define KERNEL_LDT 0x58 #define USER_LDT 0x60 -#define USER_TSS 0x68 #define FPE_CS 0x70 #define USER_FPREGS 0x78 -#define KERNEL_GS 0x80 + +#define USER_GDT 0x50 +#define USER_GDT_SLOTS 2 #define gdt base_gdt |