From b92626678c92d4a83f2963265de20fdbb9457448 Mon Sep 17 00:00:00 2001 From: brezak Date: Tue, 26 Oct 1993 15:53:54 +0000 Subject: [PATCH] Cleanup LDT/GDT defines --- sys/arch/i386/i386/machdep.c | 38 ++++++++---------------------- sys/arch/i386/i386/sys_machdep.c | 11 +-------- sys/arch/i386/include/segments.h | 40 +++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 41 deletions(-) diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 815ccb31983a..4d47b3e6ec97 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -639,6 +639,12 @@ boot(arghowto) printf("giving up\n"); else printf("done\n"); + /* + * If we've been adjusting the clock, the todr + * will be out of synch; adjust it now. + */ + resettodr(); + DELAY(10000); /* wait for printf to finish */ } splhigh(); @@ -798,36 +804,12 @@ setregs(p, entry, stack, retval) */ /* - * Initialize segments & interrupt table + * Initialize segments and descriptor tables */ -#define GNULL_SEL 0 /* Null Descriptor */ -#define GCODE_SEL 1 /* Kernel Code Descriptor */ -#define GDATA_SEL 2 /* Kernel Data Descriptor */ -#define GLDT_SEL 3 /* LDT - eventually one per process */ -#define GTGATE_SEL 4 /* Process task switch gate */ -#define GPANIC_SEL 5 /* Task state to consider panic from */ -#define GPROC0_SEL 6 /* Task state process slot zero and up */ -#define GUSERLDT_SEL 7 /* User LDT */ -#define NGDT GUSERLDT_SEL+1 - -union descriptor gdt[NGDT]; - -/* interrupt descriptor table */ -struct gate_descriptor idt[NIDT]; - -/* local descriptor table */ -#define LSYS5CALLS_SEL 0 /* forced by intel BCS */ -#define LSYS5SIGR_SEL 1 - -#define L43BSDCALLS_SEL 2 /* notyet */ -#define LUCODE_SEL 3 -#define LUDATA_SEL 4 -/* seperate stack, es,fs,gs sels ? */ -/* #define LPOSIXCALLS_SEL 5 /* notyet */ -#define NLDT LUDATA_SEL+1 - -union descriptor ldt[NLDT]; +union descriptor gdt[NGDT]; +struct gate_descriptor idt[NIDT]; +union descriptor ldt[NLDT]; int _default_ldt, currentldt; diff --git a/sys/arch/i386/i386/sys_machdep.c b/sys/arch/i386/i386/sys_machdep.c index bc7a790e6c0c..bf731908cc48 100644 --- a/sys/arch/i386/i386/sys_machdep.c +++ b/sys/arch/i386/i386/sys_machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 - * $Id: sys_machdep.c,v 1.4 1993/10/15 13:47:22 cgd Exp $ + * $Id: sys_machdep.c,v 1.5 1993/10/26 15:54:22 brezak Exp $ */ #include "npx.h" @@ -62,16 +62,7 @@ #include "vm/vm_map.h" #include "machine/sysarch.h" -#define LUDATA_SEL 4 -#define NLDT LUDATA_SEL+1 -#define GUSERLDT_SEL 7 /* User LDT */ -#define NGDT GUSERLDT_SEL+1 - extern vm_map_t kernel_map; -extern int currentldt; -extern union descriptor gdt[NGDT]; -extern union descriptor ldt[NLDT]; -extern struct soft_segment_descriptor gdt_segs[]; #ifdef TRACE int nvualarm; diff --git a/sys/arch/i386/include/segments.h b/sys/arch/i386/include/segments.h index 0b623947c461..ab7a34c4bdb8 100644 --- a/sys/arch/i386/include/segments.h +++ b/sys/arch/i386/include/segments.h @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)segments.h 7.1 (Berkeley) 5/9/91 - * $Id: segments.h,v 1.3 1993/05/22 08:00:37 cgd Exp $ + * $Id: segments.h,v 1.4 1993/10/26 15:53:54 brezak Exp $ */ /* @@ -194,12 +194,46 @@ struct region_descriptor { #define SEGEX_IDX(s) ((s)>>3)&0x1fff) /* - * Size of IDT table + * Entries in the Interrupt Descriptor Table (IDT) */ - #define NIDT 256 #define NRSVIDT 32 /* reserved entries for cpu exceptions */ +/* + * Entries in the Global Descriptor Table (GDT) + */ +#define GNULL_SEL 0 /* Null Descriptor */ +#define GCODE_SEL 1 /* Kernel Code Descriptor */ +#define GDATA_SEL 2 /* Kernel Data Descriptor */ +#define GLDT_SEL 3 /* LDT - eventually one per process */ +#define GTGATE_SEL 4 /* Process task switch gate */ +#define GPANIC_SEL 5 /* Task state to consider panic from */ +#define GPROC0_SEL 6 /* Task state process slot zero and up */ +#define GUSERLDT_SEL 7 /* User LDT */ +#define NGDT GUSERLDT_SEL+1 + +/* +/* + * Entries in the Local Descriptor Table (LDT) + */ +#define LSYS5CALLS_SEL 0 /* forced by intel BCS */ +#define LSYS5SIGR_SEL 1 +#define L43BSDCALLS_SEL 2 /* notyet */ +#define LUCODE_SEL 3 +#define LUDATA_SEL 4 +#if 0 +/* seperate stack, es,fs,gs sels ? */ +#define LPOSIXCALLS_SEL 5 /* notyet */ +#endif +#define NLDT LUDATA_SEL+1 + +#ifdef KERNEL +extern int currentldt; +extern union descriptor gdt[NGDT]; +extern union descriptor ldt[NLDT]; +extern struct soft_segment_descriptor gdt_segs[]; +#endif + #if __GNUC__ >= 2 #pragma pack(4) #endif