summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-04-07 11:00:48 +0000
committerkato <kato@FreeBSD.org>1997-04-07 11:00:48 +0000
commita3b6c4ba1cebfc3772ffa0392d22fd320b96f6c1 (patch)
tree78b8ae2a4e8a250a0e7e46fe0274a012f32450a0 /sys
parent95df505618a66c0f0006da0646dd760b1512c9a6 (diff)
downloadFreeBSD-src-a3b6c4ba1cebfc3772ffa0392d22fd320b96f6c1.zip
FreeBSD-src-a3b6c4ba1cebfc3772ffa0392d22fd320b96f6c1.tar.gz
Synchronize with sys/i386/i386{machdep.c,trap.c} revisions 1.236 and
1.91, respectively.
Diffstat (limited to 'sys')
-rw-r--r--sys/pc98/i386/machdep.c39
-rw-r--r--sys/pc98/i386/trap.c27
-rw-r--r--sys/pc98/pc98/machdep.c39
3 files changed, 69 insertions, 36 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 6cd3b891f..297061b 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.33 1997/03/29 02:48:49 kato Exp $
+ * $Id: machdep.c,v 1.34 1997/03/31 11:11:12 davidg Exp $
*/
#include "npx.h"
@@ -759,12 +759,18 @@ 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];
extern struct user *proc0paddr;
+#ifdef TSS_IS_CACHED /* cpu_switch helper */
+struct segment_descriptor *tssptr;
+int gsel_tss;
+#endif
+
/* software prototypes -- in more palatable form */
struct soft_segment_descriptor gdt_segs[] = {
/* GNULL_SEL 0 Null Descriptor */
@@ -798,7 +804,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 */
@@ -822,7 +828,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 */
@@ -966,7 +972,9 @@ init386(first)
int x;
unsigned biosbasemem, biosextmem;
struct gate_descriptor *gdp;
+#ifndef TSS_IS_CACHED
int gsel_tss;
+#endif
struct isa_device *idp;
/* table descriptors - used to load tables by microp */
struct region_descriptor r_gdt, r_idt;
@@ -1335,10 +1343,12 @@ init386(first)
avail_end + off, VM_PROT_ALL, TRUE);
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) ;
+ /* make an initial tss so cpu can get interrupt stack on syscall! */
+ common_tss.tss_esp0 = (int) proc0.p_addr + 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)];
@@ -1347,15 +1357,14 @@ init386(first)
dblfault_tss.tss_cr3 = IdlePTD;
dblfault_tss.tss_eip = (int) dblfault_handler;
dblfault_tss.tss_eflags = PSL_KERNEL;
- dblfault_tss.tss_ds = dblfault_tss.tss_es = dblfault_tss.tss_fs = dblfault_tss.tss_gs =
- GSEL(GDATA_SEL, SEL_KPL);
+ dblfault_tss.tss_ds = dblfault_tss.tss_es = dblfault_tss.tss_fs =
+ dblfault_tss.tss_gs = GSEL(GDATA_SEL, SEL_KPL);
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);
+#ifdef TSS_IS_CACHED /* cpu_switch helper */
+ tssptr = &gdt[GPROC0_SEL].sd;
+#endif
/* make a call gate to reenter kernel with */
gdp = &ldt[LSYS5CALLS_SEL].gd;
@@ -1391,9 +1400,7 @@ init386(first)
* index into the user block. Don't you just *love* virtual memory?
* (I'm starting to think seymour is right...)
*/
-#define TF_REGP(p) ((struct trapframe *) \
- ((char *)(p)->p_addr \
- + ((char *)(p)->p_md.md_regs - kstack)))
+#define TF_REGP(p) ((struct trapframe *)(p)->p_md.md_regs)
int
ptrace_set_pc(p, addr)
@@ -1425,7 +1432,7 @@ int ptrace_write_u(p, off, data)
* Privileged kernel state is scattered all over the user area.
* Only allow write access to parts of regs and to fpregs.
*/
- min = (char *)p->p_md.md_regs - kstack;
+ min = (char *)p->p_md.md_regs - (char *)p->p_addr;
if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) {
tp = TF_REGP(p);
frame_copy = *tp;
diff --git a/sys/pc98/i386/trap.c b/sys/pc98/i386/trap.c
index feec654..3e57eed 100644
--- a/sys/pc98/i386/trap.c
+++ b/sys/pc98/i386/trap.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
- * $Id: trap.c,v 1.14 1997/03/22 18:54:37 kato Exp $
+ * $Id: trap.c,v 1.15 1997/04/06 11:49:46 kato Exp $
*/
/*
@@ -813,9 +813,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");
@@ -988,3 +988,22 @@ bad:
ktrsysret(p->p_tracep, code, error, rval[0]);
#endif
}
+
+/*
+ * Simplified back end of syscall(), used when returning from fork()
+ * directly into user mode.
+ */
+void
+fork_return(p, frame)
+ struct proc *p;
+ struct trapframe frame;
+{
+ frame.tf_eax = 0; /* Child returns zero */
+ frame.tf_eflags &= ~PSL_C; /* success */
+
+ userret(p, &frame, 0);
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_SYSRET))
+ ktrsysret(p->p_tracep, SYS_fork, 0, 0);
+#endif
+}
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 6cd3b891f..297061b 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.33 1997/03/29 02:48:49 kato Exp $
+ * $Id: machdep.c,v 1.34 1997/03/31 11:11:12 davidg Exp $
*/
#include "npx.h"
@@ -759,12 +759,18 @@ 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];
extern struct user *proc0paddr;
+#ifdef TSS_IS_CACHED /* cpu_switch helper */
+struct segment_descriptor *tssptr;
+int gsel_tss;
+#endif
+
/* software prototypes -- in more palatable form */
struct soft_segment_descriptor gdt_segs[] = {
/* GNULL_SEL 0 Null Descriptor */
@@ -798,7 +804,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 */
@@ -822,7 +828,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 */
@@ -966,7 +972,9 @@ init386(first)
int x;
unsigned biosbasemem, biosextmem;
struct gate_descriptor *gdp;
+#ifndef TSS_IS_CACHED
int gsel_tss;
+#endif
struct isa_device *idp;
/* table descriptors - used to load tables by microp */
struct region_descriptor r_gdt, r_idt;
@@ -1335,10 +1343,12 @@ init386(first)
avail_end + off, VM_PROT_ALL, TRUE);
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) ;
+ /* make an initial tss so cpu can get interrupt stack on syscall! */
+ common_tss.tss_esp0 = (int) proc0.p_addr + 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)];
@@ -1347,15 +1357,14 @@ init386(first)
dblfault_tss.tss_cr3 = IdlePTD;
dblfault_tss.tss_eip = (int) dblfault_handler;
dblfault_tss.tss_eflags = PSL_KERNEL;
- dblfault_tss.tss_ds = dblfault_tss.tss_es = dblfault_tss.tss_fs = dblfault_tss.tss_gs =
- GSEL(GDATA_SEL, SEL_KPL);
+ dblfault_tss.tss_ds = dblfault_tss.tss_es = dblfault_tss.tss_fs =
+ dblfault_tss.tss_gs = GSEL(GDATA_SEL, SEL_KPL);
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);
+#ifdef TSS_IS_CACHED /* cpu_switch helper */
+ tssptr = &gdt[GPROC0_SEL].sd;
+#endif
/* make a call gate to reenter kernel with */
gdp = &ldt[LSYS5CALLS_SEL].gd;
@@ -1391,9 +1400,7 @@ init386(first)
* index into the user block. Don't you just *love* virtual memory?
* (I'm starting to think seymour is right...)
*/
-#define TF_REGP(p) ((struct trapframe *) \
- ((char *)(p)->p_addr \
- + ((char *)(p)->p_md.md_regs - kstack)))
+#define TF_REGP(p) ((struct trapframe *)(p)->p_md.md_regs)
int
ptrace_set_pc(p, addr)
@@ -1425,7 +1432,7 @@ int ptrace_write_u(p, off, data)
* Privileged kernel state is scattered all over the user area.
* Only allow write access to parts of regs and to fpregs.
*/
- min = (char *)p->p_md.md_regs - kstack;
+ min = (char *)p->p_md.md_regs - (char *)p->p_addr;
if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) {
tp = TF_REGP(p);
frame_copy = *tp;
OpenPOWER on IntegriCloud