No longer use an i386tss as the basis of our pcb - it wasn't particularly

convenient and makes life difficult for my next commit.  We still need
an i386tss to point to for the tss slot in the gdt, so we use a common
tss shared between all processes.

Note that this is going to break debugging until this series of commits
is finished.  core dumps will change again too. :-(  we really need
a more modern core dump format that doesn't depend on the pcb/upages.

This change makes VM86 mode harder, but the following commits will remove
a lot of constraints for the VM86 system, including the possibility of
extending the pcb for an IO port map etc.

Obtained from: bde
This commit is contained in:
Peter Wemm 1997-04-07 06:45:18 +00:00
parent 267bc040ef
commit 271b264e4c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24690
9 changed files with 68 additions and 116 deletions

View File

@ -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 <stdio.h>
@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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 <machine/npx.h>
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
};
/*

View File

@ -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 <stdio.h>
@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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 <machine/npx.h>
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
};
/*

View File

@ -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");