[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnumach/i386/i386 gdt.h
From: |
Roland McGrath |
Subject: |
gnumach/i386/i386 gdt.h |
Date: |
Thu, 03 Oct 2002 22:44:54 -0400 |
CVSROOT: /cvsroot/hurd
Module name: gnumach
Changes by: Roland McGrath <address@hidden> 02/10/03 22:44:53
Modified files:
i386/i386 : gdt.h
Log message:
2002-10-03 Roland McGrath <address@hidden>
* 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.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnumach/gnumach/i386/i386/gdt.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: gnumach/i386/i386/gdt.h
diff -u gnumach/i386/i386/gdt.h:1.3 gnumach/i386/i386/gdt.h:1.4
--- gnumach/i386/i386/gdt.h:1.3 Mon May 27 19:01:50 2002
+++ gnumach/i386/i386/gdt.h Thu Oct 3 22:44:53 2002
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnumach/i386/i386 gdt.h,
Roland McGrath <=