diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index f8f0018df9c4..903fad81e69d 100644 --- a/sys/amd64/amd64/genassym.c +++ b/sys/amd64/amd64/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id$ + * $Id: genassym.c,v 1.42 1997/02/22 09:32:18 peter Exp $ */ #include @@ -120,33 +120,14 @@ main() printf("#define\tVM_MAXUSER_ADDRESS 0x%lx\n", VM_MAXUSER_ADDRESS); printf("#define\tKERNBASE 0x%x\n", KERNBASE); printf("#define\tMCLBYTES %d\n", MCLBYTES); - printf("#define\tPCB_LINK %p\n", &pcb->pcb_tss.tss_link); - printf("#define\tPCB_ESP0 %p\n", &pcb->pcb_tss.tss_esp0); - printf("#define\tPCB_SS0 %p\n", &pcb->pcb_tss.tss_ss0); - printf("#define\tPCB_ESP1 %p\n", &pcb->pcb_tss.tss_esp1); - printf("#define\tPCB_SS1 %p\n", &pcb->pcb_tss.tss_ss1); - printf("#define\tPCB_ESP2 %p\n", &pcb->pcb_tss.tss_esp2); - printf("#define\tPCB_SS2 %p\n", &pcb->pcb_tss.tss_ss2); - printf("#define\tPCB_CR3 %p\n", &pcb->pcb_tss.tss_cr3); - printf("#define\tPCB_EIP %p\n", &pcb->pcb_tss.tss_eip); - printf("#define\tPCB_EFLAGS %p\n", &pcb->pcb_tss.tss_eflags); - printf("#define\tPCB_EAX %p\n", &pcb->pcb_tss.tss_eax); - printf("#define\tPCB_ECX %p\n", &pcb->pcb_tss.tss_ecx); - printf("#define\tPCB_EDX %p\n", &pcb->pcb_tss.tss_edx); - printf("#define\tPCB_EBX %p\n", &pcb->pcb_tss.tss_ebx); - printf("#define\tPCB_ESP %p\n", &pcb->pcb_tss.tss_esp); - printf("#define\tPCB_EBP %p\n", &pcb->pcb_tss.tss_ebp); - printf("#define\tPCB_ESI %p\n", &pcb->pcb_tss.tss_esi); - printf("#define\tPCB_EDI %p\n", &pcb->pcb_tss.tss_edi); - printf("#define\tPCB_ES %p\n", &pcb->pcb_tss.tss_es); - printf("#define\tPCB_CS %p\n", &pcb->pcb_tss.tss_cs); - printf("#define\tPCB_SS %p\n", &pcb->pcb_tss.tss_ss); - printf("#define\tPCB_DS %p\n", &pcb->pcb_tss.tss_ds); - printf("#define\tPCB_FS %p\n", &pcb->pcb_tss.tss_fs); - printf("#define\tPCB_GS %p\n", &pcb->pcb_tss.tss_gs); - printf("#define\tPCB_LDT %p\n", &pcb->pcb_tss.tss_ldt); + printf("#define\tPCB_CR3 %p\n", &pcb->pcb_cr3); + printf("#define\tPCB_EDI %p\n", &pcb->pcb_edi); + printf("#define\tPCB_ESI %p\n", &pcb->pcb_esi); + printf("#define\tPCB_EBP %p\n", &pcb->pcb_ebp); + printf("#define\tPCB_ESP %p\n", &pcb->pcb_esp); + printf("#define\tPCB_EBX %p\n", &pcb->pcb_ebx); + printf("#define\tPCB_EIP %p\n", &pcb->pcb_eip); printf("#define\tPCB_USERLDT %p\n", &pcb->pcb_ldt); - printf("#define\tPCB_IOOPT %p\n", &pcb->pcb_tss.tss_ioopt); printf("#define\tU_PROF %p\n", &up->u_stats.p_prof); printf("#define\tU_PROFSCALE %p\n", &up->u_stats.p_prof.pr_scale); printf("#define\tPR_BASE %p\n", &uprof->pr_base); diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 461be83fcfed..d643e10f0bfe 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.233 1997/03/28 12:37:44 joerg Exp $ + * $Id: machdep.c,v 1.234 1997/03/31 11:10:37 davidg Exp $ */ #include "npx.h" @@ -748,6 +748,7 @@ int _default_ldt; union descriptor gdt[NGDT]; /* global descriptor table */ struct gate_descriptor idt[NIDT]; /* interrupt descriptor table */ union descriptor ldt[NLDT]; /* local descriptor table */ +struct i386tss common_tss; static struct i386tss dblfault_tss; static char dblfault_stack[PAGE_SIZE]; @@ -787,7 +788,7 @@ struct soft_segment_descriptor gdt_segs[] = { { (int) ldt, /* segment base address */ sizeof(ldt)-1, /* length - all address space */ SDT_SYSLDT, /* segment type */ - 0, /* segment descriptor priority level */ + SEL_UPL, /* segment descriptor priority level */ 1, /* segment descriptor present */ 0, 0, 0, /* unused - default 32 vs 16 bit size */ @@ -811,7 +812,7 @@ struct soft_segment_descriptor gdt_segs[] = { 0, /* unused - default 32 vs 16 bit size */ 0 /* limit granularity (byte/page units)*/ }, /* GPROC0_SEL 6 Proc 0 Tss Descriptor */ -{ (int) kstack, /* segment base address */ +{ (int) &common_tss, /* segment base address */ sizeof(struct i386tss)-1,/* length - all address space */ SDT_SYS386TSS, /* segment type */ 0, /* segment descriptor priority level */ @@ -1300,9 +1301,11 @@ init386(first) msgbufmapped = 1; /* make a initial tss so microp can get interrupt stack on syscall! */ - proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE; - proc0.p_addr->u_pcb.pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; + common_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE; + common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; + common_tss.tss_ioopt = (sizeof common_tss) << 16; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); + ltr(gsel_tss); dblfault_tss.tss_esp = dblfault_tss.tss_esp0 = dblfault_tss.tss_esp1 = dblfault_tss.tss_esp2 = (int) &dblfault_stack[sizeof(dblfault_stack)]; @@ -1316,11 +1319,6 @@ init386(first) dblfault_tss.tss_cs = GSEL(GCODE_SEL, SEL_KPL); dblfault_tss.tss_ldt = GSEL(GLDT_SEL, SEL_KPL); - ((struct i386tss *)gdt_segs[GPROC0_SEL].ssd_base)->tss_ioopt = - (sizeof(struct i386tss))<<16; - - ltr(gsel_tss); - /* make a call gate to reenter kernel with */ gdp = &ldt[LSYS5CALLS_SEL].gd; diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 5e1f171f87f8..5aff98f37ad2 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.88 1997/02/22 09:32:55 peter Exp $ + * $Id: trap.c,v 1.89 1997/04/06 02:29:19 dyson Exp $ */ /* @@ -763,9 +763,9 @@ dblfault_handler() if (pcb != NULL) { printf("\nFatal double fault:\n"); - printf("eip = 0x%x\n", pcb->pcb_tss.tss_eip); - printf("esp = 0x%x\n", pcb->pcb_tss.tss_esp); - printf("ebp = 0x%x\n", pcb->pcb_tss.tss_ebp); + printf("eip = 0x%x\n", pcb->pcb_eip); + printf("esp = 0x%x\n", pcb->pcb_esp); + printf("ebp = 0x%x\n", pcb->pcb_ebp); } panic("double fault"); diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h index 35a61adef94d..ecfd8b2c315d 100644 --- a/sys/amd64/include/pcb.h +++ b/sys/amd64/include/pcb.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 - * $Id$ + * $Id: pcb.h,v 1.18 1997/02/22 09:34:56 peter Exp $ */ #ifndef _I386_PCB_H_ @@ -47,26 +47,23 @@ #include struct pcb { - struct i386tss pcb_tss; -#define pcb_ksp pcb_tss.tss_esp0 -#define pcb_ptd pcb_tss.tss_cr3 -#define pcb_cr3 pcb_ptd -#define pcb_pc pcb_tss.tss_eip -#define pcb_psl pcb_tss.tss_eflags -#define pcb_usp pcb_tss.tss_esp -#define pcb_fp pcb_tss.tss_ebp -#ifdef notyet - u_char pcb_iomap[NPORT/sizeof(u_char)]; /* i/o port bitmap */ -#endif + int pcb_cr3; + int pcb_edi; + int pcb_esi; + int pcb_ebp; + int pcb_esp; + int pcb_ebx; + int pcb_eip; caddr_t pcb_ldt; /* per process (user) LDT */ int pcb_ldt_len; /* number of LDT entries */ struct save87 pcb_savefpu; /* floating point state for 287/387 */ -/* - * Software pcb (extension) - */ u_char pcb_flags; #define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */ caddr_t pcb_onfault; /* copyin/out fault recovery */ +#if 0 /* some day we may switch between procs that have their own i386tss */ + struct i386tss pcb_tss; + u_char pcb_iomap[NPORT/sizeof(u_char)]; /* i/o port bitmap */ +#endif }; /* diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index f8f0018df9c4..903fad81e69d 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id$ + * $Id: genassym.c,v 1.42 1997/02/22 09:32:18 peter Exp $ */ #include @@ -120,33 +120,14 @@ main() printf("#define\tVM_MAXUSER_ADDRESS 0x%lx\n", VM_MAXUSER_ADDRESS); printf("#define\tKERNBASE 0x%x\n", KERNBASE); printf("#define\tMCLBYTES %d\n", MCLBYTES); - printf("#define\tPCB_LINK %p\n", &pcb->pcb_tss.tss_link); - printf("#define\tPCB_ESP0 %p\n", &pcb->pcb_tss.tss_esp0); - printf("#define\tPCB_SS0 %p\n", &pcb->pcb_tss.tss_ss0); - printf("#define\tPCB_ESP1 %p\n", &pcb->pcb_tss.tss_esp1); - printf("#define\tPCB_SS1 %p\n", &pcb->pcb_tss.tss_ss1); - printf("#define\tPCB_ESP2 %p\n", &pcb->pcb_tss.tss_esp2); - printf("#define\tPCB_SS2 %p\n", &pcb->pcb_tss.tss_ss2); - printf("#define\tPCB_CR3 %p\n", &pcb->pcb_tss.tss_cr3); - printf("#define\tPCB_EIP %p\n", &pcb->pcb_tss.tss_eip); - printf("#define\tPCB_EFLAGS %p\n", &pcb->pcb_tss.tss_eflags); - printf("#define\tPCB_EAX %p\n", &pcb->pcb_tss.tss_eax); - printf("#define\tPCB_ECX %p\n", &pcb->pcb_tss.tss_ecx); - printf("#define\tPCB_EDX %p\n", &pcb->pcb_tss.tss_edx); - printf("#define\tPCB_EBX %p\n", &pcb->pcb_tss.tss_ebx); - printf("#define\tPCB_ESP %p\n", &pcb->pcb_tss.tss_esp); - printf("#define\tPCB_EBP %p\n", &pcb->pcb_tss.tss_ebp); - printf("#define\tPCB_ESI %p\n", &pcb->pcb_tss.tss_esi); - printf("#define\tPCB_EDI %p\n", &pcb->pcb_tss.tss_edi); - printf("#define\tPCB_ES %p\n", &pcb->pcb_tss.tss_es); - printf("#define\tPCB_CS %p\n", &pcb->pcb_tss.tss_cs); - printf("#define\tPCB_SS %p\n", &pcb->pcb_tss.tss_ss); - printf("#define\tPCB_DS %p\n", &pcb->pcb_tss.tss_ds); - printf("#define\tPCB_FS %p\n", &pcb->pcb_tss.tss_fs); - printf("#define\tPCB_GS %p\n", &pcb->pcb_tss.tss_gs); - printf("#define\tPCB_LDT %p\n", &pcb->pcb_tss.tss_ldt); + printf("#define\tPCB_CR3 %p\n", &pcb->pcb_cr3); + printf("#define\tPCB_EDI %p\n", &pcb->pcb_edi); + printf("#define\tPCB_ESI %p\n", &pcb->pcb_esi); + printf("#define\tPCB_EBP %p\n", &pcb->pcb_ebp); + printf("#define\tPCB_ESP %p\n", &pcb->pcb_esp); + printf("#define\tPCB_EBX %p\n", &pcb->pcb_ebx); + printf("#define\tPCB_EIP %p\n", &pcb->pcb_eip); printf("#define\tPCB_USERLDT %p\n", &pcb->pcb_ldt); - printf("#define\tPCB_IOOPT %p\n", &pcb->pcb_tss.tss_ioopt); printf("#define\tU_PROF %p\n", &up->u_stats.p_prof); printf("#define\tU_PROFSCALE %p\n", &up->u_stats.p_prof.pr_scale); printf("#define\tPR_BASE %p\n", &uprof->pr_base); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 461be83fcfed..d643e10f0bfe 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.233 1997/03/28 12:37:44 joerg Exp $ + * $Id: machdep.c,v 1.234 1997/03/31 11:10:37 davidg Exp $ */ #include "npx.h" @@ -748,6 +748,7 @@ int _default_ldt; union descriptor gdt[NGDT]; /* global descriptor table */ struct gate_descriptor idt[NIDT]; /* interrupt descriptor table */ union descriptor ldt[NLDT]; /* local descriptor table */ +struct i386tss common_tss; static struct i386tss dblfault_tss; static char dblfault_stack[PAGE_SIZE]; @@ -787,7 +788,7 @@ struct soft_segment_descriptor gdt_segs[] = { { (int) ldt, /* segment base address */ sizeof(ldt)-1, /* length - all address space */ SDT_SYSLDT, /* segment type */ - 0, /* segment descriptor priority level */ + SEL_UPL, /* segment descriptor priority level */ 1, /* segment descriptor present */ 0, 0, 0, /* unused - default 32 vs 16 bit size */ @@ -811,7 +812,7 @@ struct soft_segment_descriptor gdt_segs[] = { 0, /* unused - default 32 vs 16 bit size */ 0 /* limit granularity (byte/page units)*/ }, /* GPROC0_SEL 6 Proc 0 Tss Descriptor */ -{ (int) kstack, /* segment base address */ +{ (int) &common_tss, /* segment base address */ sizeof(struct i386tss)-1,/* length - all address space */ SDT_SYS386TSS, /* segment type */ 0, /* segment descriptor priority level */ @@ -1300,9 +1301,11 @@ init386(first) msgbufmapped = 1; /* make a initial tss so microp can get interrupt stack on syscall! */ - proc0.p_addr->u_pcb.pcb_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE; - proc0.p_addr->u_pcb.pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; + common_tss.tss_esp0 = (int) kstack + UPAGES*PAGE_SIZE; + common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; + common_tss.tss_ioopt = (sizeof common_tss) << 16; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); + ltr(gsel_tss); dblfault_tss.tss_esp = dblfault_tss.tss_esp0 = dblfault_tss.tss_esp1 = dblfault_tss.tss_esp2 = (int) &dblfault_stack[sizeof(dblfault_stack)]; @@ -1316,11 +1319,6 @@ init386(first) dblfault_tss.tss_cs = GSEL(GCODE_SEL, SEL_KPL); dblfault_tss.tss_ldt = GSEL(GLDT_SEL, SEL_KPL); - ((struct i386tss *)gdt_segs[GPROC0_SEL].ssd_base)->tss_ioopt = - (sizeof(struct i386tss))<<16; - - ltr(gsel_tss); - /* make a call gate to reenter kernel with */ gdp = &ldt[LSYS5CALLS_SEL].gd; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 5e1f171f87f8..5aff98f37ad2 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.88 1997/02/22 09:32:55 peter Exp $ + * $Id: trap.c,v 1.89 1997/04/06 02:29:19 dyson Exp $ */ /* @@ -763,9 +763,9 @@ dblfault_handler() if (pcb != NULL) { printf("\nFatal double fault:\n"); - printf("eip = 0x%x\n", pcb->pcb_tss.tss_eip); - printf("esp = 0x%x\n", pcb->pcb_tss.tss_esp); - printf("ebp = 0x%x\n", pcb->pcb_tss.tss_ebp); + printf("eip = 0x%x\n", pcb->pcb_eip); + printf("esp = 0x%x\n", pcb->pcb_esp); + printf("ebp = 0x%x\n", pcb->pcb_ebp); } panic("double fault"); diff --git a/sys/i386/include/pcb.h b/sys/i386/include/pcb.h index 35a61adef94d..ecfd8b2c315d 100644 --- a/sys/i386/include/pcb.h +++ b/sys/i386/include/pcb.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 - * $Id$ + * $Id: pcb.h,v 1.18 1997/02/22 09:34:56 peter Exp $ */ #ifndef _I386_PCB_H_ @@ -47,26 +47,23 @@ #include struct pcb { - struct i386tss pcb_tss; -#define pcb_ksp pcb_tss.tss_esp0 -#define pcb_ptd pcb_tss.tss_cr3 -#define pcb_cr3 pcb_ptd -#define pcb_pc pcb_tss.tss_eip -#define pcb_psl pcb_tss.tss_eflags -#define pcb_usp pcb_tss.tss_esp -#define pcb_fp pcb_tss.tss_ebp -#ifdef notyet - u_char pcb_iomap[NPORT/sizeof(u_char)]; /* i/o port bitmap */ -#endif + int pcb_cr3; + int pcb_edi; + int pcb_esi; + int pcb_ebp; + int pcb_esp; + int pcb_ebx; + int pcb_eip; caddr_t pcb_ldt; /* per process (user) LDT */ int pcb_ldt_len; /* number of LDT entries */ struct save87 pcb_savefpu; /* floating point state for 287/387 */ -/* - * Software pcb (extension) - */ u_char pcb_flags; #define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */ caddr_t pcb_onfault; /* copyin/out fault recovery */ +#if 0 /* some day we may switch between procs that have their own i386tss */ + struct i386tss pcb_tss; + u_char pcb_iomap[NPORT/sizeof(u_char)]; /* i/o port bitmap */ +#endif }; /* diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 5e1f171f87f8..5aff98f37ad2 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.88 1997/02/22 09:32:55 peter Exp $ + * $Id: trap.c,v 1.89 1997/04/06 02:29:19 dyson Exp $ */ /* @@ -763,9 +763,9 @@ dblfault_handler() if (pcb != NULL) { printf("\nFatal double fault:\n"); - printf("eip = 0x%x\n", pcb->pcb_tss.tss_eip); - printf("esp = 0x%x\n", pcb->pcb_tss.tss_esp); - printf("ebp = 0x%x\n", pcb->pcb_tss.tss_ebp); + printf("eip = 0x%x\n", pcb->pcb_eip); + printf("esp = 0x%x\n", pcb->pcb_esp); + printf("ebp = 0x%x\n", pcb->pcb_ebp); } panic("double fault");