[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnumach/oskit/x86 main.c
From: |
Roland McGrath |
Subject: |
gnumach/oskit/x86 main.c |
Date: |
Thu, 03 Oct 2002 22:44:57 -0400 |
CVSROOT: /cvsroot/hurd
Module name: gnumach
Changes by: Roland McGrath <address@hidden> 02/10/03 22:44:56
Modified files:
oskit/x86 : main.c
Log message:
2002-10-03 Roland McGrath <address@hidden>
* 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.
* oskit/x86/main.c (main): BASE_TSS -> KERNEL_TSS
* i386/i386/mp_desc.c (mp_desc_load): Likewise.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnumach/gnumach/oskit/x86/main.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gnumach/oskit/x86/main.c
diff -u gnumach/oskit/x86/main.c:1.2 gnumach/oskit/x86/main.c:1.3
--- gnumach/oskit/x86/main.c:1.2 Mon May 27 19:01:57 2002
+++ gnumach/oskit/x86/main.c Thu Oct 3 22:44:56 2002
@@ -24,10 +24,10 @@
#include <oskit/x86/proc_reg.h>
#include <oskit/x86/paging.h>
#include <oskit/x86/base_vm.h>
-#include <oskit/x86/base_gdt.h>
#include <oskit/c/unistd.h>
#include <oskit/dev/dev.h>
#include <oskit/smp.h>
+#include "gdt.h"
#include <string.h>
@@ -43,13 +43,6 @@
#include <kern/cpu_number.h>
-/* The BASE_TSS in OSKit has no I/O permission bitmap, but we want
- one. So we replace it with an extended TSS at link-time. */
-#include <machine/tss.h>
-#include <machine/io_perm.h>
-static struct task_tss ktss;
-extern struct x86_tss base_tss __attribute__ ((alias ("ktss")));
-
/* As of 2000-12-21 the oskit has an incorrect value for this constant
in <oskit/x86/proc_reg.h>, so we redefine it with the correct one. */
#undef CR4_PGE
@@ -152,15 +145,11 @@
int_init();
ldt_init();
- /* Set up the BASE_TSS to include an I/O permission bitmap. */
- fill_descriptor(&base_gdt[sel_idx(BASE_TSS)],
- kvtolin(&ktss),
- sizeof(struct task_tss) - 1,
- ACC_P|ACC_PL_K|ACC_TSS, 0);
- ktss.tss.io_bit_map_offset = IOPB_INVAL;
- ktss.barrier = 0xFF;
- /* This will also reload the TSS. */
- base_cpu_load();
+ base_cpu_load(); /* Load all the new tables into the CPU. */
+
+ /* Now reload the TSS using our slot instead of the oskit's. */
+ base_gdt[sel_idx (KERNEL_TSS)].access &= ~ACC_TSS_BUSY;
+ set_tr(KERNEL_TSS);
/* Arrange a callback to our special exit function below, so we can
try to return to a state the generic oskit reboot code can cope with. */
@@ -246,6 +235,10 @@
set_cr4 (get_cr4 () &~ CR4_PGE);
set_pdbr (kvtophys (kernel_page_dir));
+ /* Reload the oskit's GDT slots. */
+ base_gdt_init ();
+ base_gdt_load ();
+
asm volatile (" ljmp %0,$1f \n" /* Switch to LINEAR_CS, */
"1: movw %w1,%%ds\n" /* Switch %ds to LINEAR_DS. */
" movw %w1,%%es\n" /* Switch %es to LINEAR_DS. */
@@ -385,4 +378,10 @@
/* Catch interrupt stack overflow. */
set_b0 (kvtolin (&base_stack_start), DR7_LEN_4, DR7_RW_DATA);
base_gdt_load(); /* necessary after setting debug regs */
+
+ /* That loaded the oskit's selectors. Now reload ours. */
+ asm volatile("ljmp %0,$1f\n\t1:" : : "i" (KERNEL_CS));
+ set_ds(KERNEL_DS);
+ set_es(KERNEL_DS);
+ set_ss(KERNEL_DS);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnumach/oskit/x86 main.c,
Roland McGrath <=