Update to match include files. Eliminate _ucodesel, _udatasel, and IdlePTD.

This commit is contained in:
mycroft 1995-05-01 08:06:22 +00:00
parent 5a7e987371
commit 17dd9534bf
12 changed files with 84 additions and 105 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.2 1995/04/22 20:26:25 christos Exp $ */
/* $NetBSD: linux_machdep.c,v 1.3 1995/05/01 08:06:22 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -92,7 +92,7 @@ linux_sendsig(catcher, sig, mask, code)
int oonstack;
extern char linux_sigcode[], linux_esigcode[];
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
/*
@ -148,10 +148,11 @@ linux_sendsig(catcher, sig, mask, code)
tf->tf_esp = (int)fp;
tf->tf_eip = (int)(((char *)PS_STRINGS) -
(linux_esigcode - linux_sigcode));
#ifdef VM86
tf->tf_eflags &= ~PSL_VM;
#endif
tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
tf->tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_es = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
}
@ -177,7 +178,7 @@ linux_sigreturn(p, uap, retval)
struct linux_sigcontext *scp, context;
register struct trapframe *tf;
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
/*
* The trampoline code hands us the context.

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.126 1995/05/01 07:55:21 mycroft Exp $ */
/* $NetBSD: locore.s,v 1.127 1995/05/01 08:06:25 mycroft Exp $ */
#undef DIAGNOSTIC
#define DIAGNOSTIC
@ -493,9 +493,8 @@ begin:
/*
* Set up the initial stack frame for execve() to munge.
*/
.globl __ucodesel,__udatasel
movl __ucodesel,%eax
movl __udatasel,%ecx
movl $LSEL(LUCODE_SEL, SEL_UPL),%eax
movl $LSEL(LUDATA_SEL, SEL_UPL),%ecx
pushl %ecx # user ss
pushl $0xdeadbeef # user esp (set by execve)
pushl $PSL_USERSET # user eflags

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.153 1995/05/01 04:48:36 mycroft Exp $ */
/* $NetBSD: machdep.c,v 1.154 1995/05/01 08:06:36 mycroft Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@ -124,7 +124,7 @@ extern vm_offset_t avail_start, avail_end;
static vm_offset_t hole_start, hole_end;
static vm_offset_t avail_next;
int _udatasel, _ucodesel, _gsel_tss;
int _gsel_tss;
caddr_t allocsys __P((caddr_t));
void dumpsys __P((void));
@ -508,7 +508,7 @@ sendsig(catcher, sig, mask, code)
*/
frame.sf_signum = sig;
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
/*
@ -561,11 +561,13 @@ sendsig(catcher, sig, mask, code)
*/
tf->tf_esp = (int)fp;
tf->tf_eip = (int)(((char *)PS_STRINGS) - (esigcode - sigcode));
#ifdef VM86
tf->tf_eflags &= ~PSL_VM;
tf->tf_cs = _ucodesel;
tf->tf_ds = _udatasel;
tf->tf_es = _udatasel;
tf->tf_ss = _udatasel;
#endif
tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
tf->tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_es = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
}
/*
@ -588,7 +590,7 @@ sigreturn(p, uap, retval)
struct sigcontext *scp, context;
register struct trapframe *tf;
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
/*
* The trampoline code hands us the context.
@ -600,7 +602,10 @@ sigreturn(p, uap, retval)
return (EFAULT);
/*
* Check for security violations.
* Check for security violations. If we're returning to protected
* mode, the CPU will validate the segment registers automatically
* and generate a trap on violations. We handle the trap, rather
* than doing all of the checking here.
*/
if (((context.sc_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
ISPL(context.sc_cs) != SEL_UPL)
@ -665,7 +670,7 @@ boot(howto)
} else {
if (howto & RB_DUMP) {
savectx(&dumppcb, 0);
dumppcb.pcb_ptd = rcr3();
dumppcb.pcb_cr3 = rcr3();
dumpsys();
}
}
@ -800,23 +805,23 @@ setregs(p, pack, stack, retval)
u_long stack;
register_t *retval;
{
register struct trapframe *tf;
register struct pcb *pcb;
tf = (struct trapframe *)p->p_md.md_regs;
tf->tf_ebp = 0; /* bottom of the fp chain */
tf->tf_eip = pack->ep_entry;
tf->tf_esp = stack;
tf->tf_ss = _udatasel;
tf->tf_ds = _udatasel;
tf->tf_es = _udatasel;
tf->tf_cs = _ucodesel;
tf->tf_eflags = PSL_USERSET | (tf->tf_eflags & PSL_T);
register struct trapframe *tf;
pcb = &p->p_addr->u_pcb;
lcr0(pcb->pcb_cr0 |= CR0_EM);
pcb->pcb_flags = 0;
tf = p->p_md.md_regs;
tf->tf_es = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_ebp = 0;
tf->tf_eip = pack->ep_entry;
tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
tf->tf_eflags = PSL_USERSET;
tf->tf_esp = stack;
tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
retval[1] = 0;
}
@ -834,13 +839,13 @@ struct gate_descriptor idt[NIDT];
int _default_ldt, currentldt;
struct i386tss tss, panic_tss;
struct i386tss tss;
extern struct user *proc0paddr;
/* software prototypes -- in more palatable form */
struct soft_segment_descriptor gdt_segs[] = {
/* Null Descriptor */
/* Null descriptor */
{ 0x0, /* segment base address */
0x0, /* length */
0, /* segment type */
@ -849,7 +854,7 @@ struct soft_segment_descriptor gdt_segs[] = {
0, 0,
0, /* default 32 vs 16 bit size */
0 /* limit granularity (byte/page units)*/ },
/* Code Descriptor for kernel */
/* Kernel code descriptor */
{ 0x0, /* segment base address */
0xfffff, /* length - all address space */
SDT_MEMERA, /* segment type */
@ -858,7 +863,7 @@ struct soft_segment_descriptor gdt_segs[] = {
0, 0,
1, /* default 32 vs 16 bit size */
1 /* limit granularity (byte/page units)*/ },
/* Data Descriptor for kernel */
/* Kernel data descriptor */
{ 0x0, /* segment base address */
0xfffff, /* length - all address space */
SDT_MEMRWA, /* segment type */
@ -876,24 +881,6 @@ struct soft_segment_descriptor gdt_segs[] = {
0, 0,
0, /* unused - default 32 vs 16 bit size */
0 /* limit granularity (byte/page units)*/ },
/* Null Descriptor - Placeholder */
{ 0x0, /* segment base address */
0x0, /* length */
0, /* segment type */
0, /* segment descriptor priority level */
0, /* segment descriptor present */
0, 0,
0, /* default 32 vs 16 bit size */
0 /* limit granularity (byte/page units)*/ },
/* Panic Tss Descriptor */
{ (int) &panic_tss, /* segment base address */
sizeof(tss)-1, /* length - all address space */
SDT_SYS386TSS, /* segment type */
0, /* segment descriptor priority level */
1, /* segment descriptor present */
0, 0,
0, /* unused - default 32 vs 16 bit size */
0 /* limit granularity (byte/page units)*/ },
/* Proc 0 Tss Descriptor */
{ (int) USRSTACK, /* segment base address */
sizeof(tss)-1, /* length - all address space */
@ -933,16 +920,7 @@ struct soft_segment_descriptor ldt_segs[] = {
0, 0,
0, /* default 32 vs 16 bit size */
0 /* limit granularity (byte/page units)*/ },
/* Null Descriptor - overwritten by call gate */
{ 0x0, /* segment base address */
0x0, /* length */
0, /* segment type */
0, /* segment descriptor priority level */
0, /* segment descriptor present */
0, 0,
0, /* default 32 vs 16 bit size */
0 /* limit granularity (byte/page units)*/ },
/* Code Descriptor for user */
/* User code descriptor */
{ 0x0, /* segment base address */
0xfffff, /* length - all address space */
SDT_MEMERA, /* segment type */
@ -951,7 +929,7 @@ struct soft_segment_descriptor ldt_segs[] = {
0, 0,
1, /* default 32 vs 16 bit size */
1 /* limit granularity (byte/page units)*/ },
/* Data Descriptor for user */
/* User data descriptor */
{ 0x0, /* segment base address */
0xfffff, /* length - all address space */
SDT_MEMRWA, /* segment type */
@ -1028,7 +1006,7 @@ init386(first_avail)
struct region_descriptor region;
extern char etext[], sigcode[], esigcode[];
extern void consinit __P((void));
extern lgdt();
extern void lgdt();
proc0.p_addr = proc0paddr;
@ -1037,11 +1015,11 @@ init386(first_avail)
/* Set up proc 0's PCB and TSS. */
curpcb = pcb = &proc0.p_addr->u_pcb;
pcb->pcb_flags = 0;
pcb->pcb_ptd = IdlePTD;
pcb->pcb_tss.tss_esp0 = (int)USRSTACK + USPACE;
pcb->pcb_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
pcb->pcb_tss.tss_ioopt = sizeof(struct i386tss) << 16;
#ifndef LKM
/* set code segment limit to end of kernel text */
gdt_segs[GCODE_SEL].ssd_limit = i386_btop(i386_round_page(&etext)) - 1;
@ -1146,10 +1124,6 @@ init386(first_avail)
ltr(_gsel_tss);
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
lldt(currentldt = _default_ldt);
/* transfer to user mode */
_ucodesel = LSEL(LUCODE_SEL, SEL_UPL);
_udatasel = LSEL(LUDATA_SEL, SEL_UPL);
}
struct queue {

View File

@ -1,4 +1,4 @@
/* $NetBSD: math_emulate.c,v 1.11 1994/11/04 20:47:07 mycroft Exp $ */
/* $NetBSD: math_emulate.c,v 1.12 1995/05/01 08:06:42 mycroft Exp $ */
/*
* expediant "port" of linux 8087 emulator to 386BSD, with apologies -wfj
@ -68,7 +68,7 @@ static temp_real_unaligned * __st(int i);
I387.twd = 0x0000; \
} while (0)
math_emulate(struct trapframe * info)
math_emulate(struct trapframe *info)
{
u_short code;
temp_real tmp;
@ -529,7 +529,7 @@ static int __regoffset[] = {
tEAX, tECX, tEDX, tEBX, tESP, tEBP, tESI, tEDI
};
#define REG(x) (curproc->p_md.md_regs[__regoffset[(x)]])
#define REG(x) (((int *)curproc->p_md.md_regs)[__regoffset[(x)]])
static char * sib(struct trapframe * info, int mod)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.28 1995/04/10 13:14:36 mycroft Exp $ */
/* $NetBSD: mem.c,v 1.29 1995/05/01 08:06:44 mycroft Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -71,7 +71,7 @@ mmopen(dev, flag, mode)
case 14:
if (flag & FWRITE) {
struct trapframe *fp;
fp = (struct trapframe *)curproc->p_md.md_regs;
fp = curproc->p_md.md_regs;
fp->tf_eflags |= PSL_IOPL;
}
break;

View File

@ -1,7 +1,7 @@
/* $NetBSD: pmap.c,v 1.30 1995/04/21 06:23:56 mycroft Exp $ */
/* $NetBSD: pmap.c,v 1.31 1995/05/01 08:06:46 mycroft Exp $ */
/*
* Copyright (c) 1993, 1994 Charles Hannum.
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
* Copyright (c) 1991 Regents of the University of California.
* All rights reserved.
*
@ -216,7 +216,6 @@ pmap_bootstrap(virtual_start)
#if notyet
extern vm_offset_t reserve_dumppages(vm_offset_t);
#endif
extern int IdlePTD;
/* XXX: allow for msgbuf */
avail_end -= i386_round_page(sizeof(struct msgbuf));
@ -240,13 +239,14 @@ pmap_bootstrap(virtual_start)
firstaddr += NBPG;
for (x = i386_btod(VM_MIN_KERNEL_ADDRESS);
x < i386_btod(VM_MIN_KERNEL_ADDRESS) + NKPDE; x++) {
x < i386_btod(VM_MIN_KERNEL_ADDRESS) + NKPDE; x++) {
pd_entry_t *pde;
pde = pmap_kernel()->pm_pdir + x;
*pde = (firstaddr + x*NBPG) | PG_V | PG_KW;
}
#else
pmap_kernel()->pm_pdir = (pd_entry_t *)(KERNBASE + IdlePTD);
pmap_kernel()->pm_pdir =
(pd_entry_t *)(proc0.p_addr->u_pcb.pcb_cr3 + KERNBASE);
#endif
simple_lock_init(&pmap_kernel()->pm_lock);

View File

@ -1,6 +1,7 @@
/* $NetBSD: process_machdep.c,v 1.12 1995/01/15 00:42:01 mycroft Exp $ */
/* $NetBSD: process_machdep.c,v 1.13 1995/05/01 08:06:48 mycroft Exp $ */
/*
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
* Copyright (c) 1993 The Regents of the University of California.
* Copyright (c) 1993 Jan-Simon Pendry
* All rights reserved.

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_machdep.c,v 1.6 1995/04/28 23:11:37 christos Exp $ */
/* $NetBSD: svr4_machdep.c,v 1.7 1995/05/01 08:06:49 mycroft Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@ -54,8 +54,6 @@
#include <machine/sysarch.h>
#include <machine/svr4_machdep.h>
extern int _ucodesel, _udatasel;
static void svr4_getsiginfo __P((union svr4_siginfo *, int, u_long, caddr_t));
void
@ -64,7 +62,7 @@ svr4_getcontext(p, uc, mask, oonstack)
struct svr4_ucontext *uc;
int mask, oonstack;
{
struct trapframe *tf = (struct trapframe *)p->p_md.md_regs;
struct trapframe *tf = p->p_md.md_regs;
struct sigacts *psp = p->p_sigacts;
svr4_greg_t* r = uc->uc_mcontext.greg;
svr4_stack_t *s = &uc->uc_stack;
@ -149,7 +147,7 @@ svr4_setcontext(p, uc)
* set to 0 right now?
*/
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
/*
* Check for security violations.
@ -313,7 +311,7 @@ svr4_sendsig(catcher, sig, mask, code)
int oonstack;
extern char svr4_esigcode[], svr4_sigcode[];
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
/*
@ -363,11 +361,13 @@ svr4_sendsig(catcher, sig, mask, code)
tf->tf_esp = (int)fp;
tf->tf_eip = (int)(((char *)PS_STRINGS) -
(svr4_esigcode - svr4_sigcode));
#ifdef VM86
tf->tf_eflags &= ~PSL_VM;
tf->tf_cs = _ucodesel;
tf->tf_ds = _udatasel;
tf->tf_es = _udatasel;
tf->tf_ss = _udatasel;
#endif
tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
tf->tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_es = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
}

View File

@ -1,9 +1,9 @@
/* $NetBSD: trap.c,v 1.82 1995/04/26 00:00:23 mycroft Exp $ */
/* $NetBSD: trap.c,v 1.83 1995/05/01 08:06:51 mycroft Exp $ */
#undef DEBUG
#define DEBUG
/*-
* Copyright (c) 1995 Charles Hannum.
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
@ -187,7 +187,7 @@ trap(frame)
if (ISPL(frame.tf_cs) != SEL_KPL) {
type |= T_USER;
sticks = p->p_sticks;
p->p_md.md_regs = (int *)&frame;
p->p_md.md_regs = &frame;
}
switch (type) {
@ -487,7 +487,7 @@ trapwrite(addr)
/*ARGSUSED*/
void
syscall(frame)
volatile struct trapframe frame;
struct trapframe frame;
{
register caddr_t params;
register struct sysent *callp;
@ -508,7 +508,7 @@ syscall(frame)
panic("syscall");
p = curproc;
sticks = p->p_sticks;
p->p_md.md_regs = (int *)&frame;
p->p_md.md_regs = &frame;
opc = frame.tf_eip;
code = frame.tf_eax;

View File

@ -1,6 +1,7 @@
/* $NetBSD: vm_machdep.c,v 1.44 1995/05/01 04:50:28 mycroft Exp $ */
/* $NetBSD: vm_machdep.c,v 1.45 1995/05/01 08:06:53 mycroft Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
* Copyright (c) 1982, 1986 The Regents of the University of California.
* Copyright (c) 1989, 1990 William Jolitz
* All rights reserved.
@ -103,6 +104,7 @@ cpu_fork(p1, p2)
pcb->pcb_cr0 |= CR0_TS;
#ifdef USER_LDT
/* Copy the LDT, if necessary. */
if (pcb->pcb_ldt) {
size_t len;
union descriptor *new_ldt;
@ -127,7 +129,7 @@ cpu_fork(p1, p2)
pmap_enter(&p2->p_vmspace->vm_pmap,
(vm_offset_t)kstack + i * NBPG,
pmap_extract(pmap_kernel(),
(vm_offset_t)p2->p_addr + i * NBPG),
(vm_offset_t)p2->p_addr + i * NBPG),
VM_PROT_READ | VM_PROT_WRITE, TRUE);
pmap_activate(&p2->p_vmspace->vm_pmap, pcb);
@ -206,7 +208,7 @@ cpu_coredump(p, vp, cred, chdr)
npxsave();
#endif
cpustate.regs = *(struct trapframe *)p->p_md.md_regs;
cpustate.regs = *p->p_md.md_regs;
cpustate.fpstate = p->p_addr->u_pcb.pcb_savefpu;
CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_I386, CORE_CPU);

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.2 1995/04/22 20:26:25 christos Exp $ */
/* $NetBSD: linux_machdep.c,v 1.3 1995/05/01 08:06:22 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -92,7 +92,7 @@ linux_sendsig(catcher, sig, mask, code)
int oonstack;
extern char linux_sigcode[], linux_esigcode[];
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
/*
@ -148,10 +148,11 @@ linux_sendsig(catcher, sig, mask, code)
tf->tf_esp = (int)fp;
tf->tf_eip = (int)(((char *)PS_STRINGS) -
(linux_esigcode - linux_sigcode));
#ifdef VM86
tf->tf_eflags &= ~PSL_VM;
#endif
tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
tf->tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_es = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
}
@ -177,7 +178,7 @@ linux_sigreturn(p, uap, retval)
struct linux_sigcontext *scp, context;
register struct trapframe *tf;
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
/*
* The trampoline code hands us the context.

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.2 1995/04/22 20:26:25 christos Exp $ */
/* $NetBSD: linux_machdep.c,v 1.3 1995/05/01 08:06:22 mycroft Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@ -92,7 +92,7 @@ linux_sendsig(catcher, sig, mask, code)
int oonstack;
extern char linux_sigcode[], linux_esigcode[];
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
/*
@ -148,10 +148,11 @@ linux_sendsig(catcher, sig, mask, code)
tf->tf_esp = (int)fp;
tf->tf_eip = (int)(((char *)PS_STRINGS) -
(linux_esigcode - linux_sigcode));
#ifdef VM86
tf->tf_eflags &= ~PSL_VM;
#endif
tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
tf->tf_ds = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_es = LSEL(LUDATA_SEL, SEL_UPL);
tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
}
@ -177,7 +178,7 @@ linux_sigreturn(p, uap, retval)
struct linux_sigcontext *scp, context;
register struct trapframe *tf;
tf = (struct trapframe *)p->p_md.md_regs;
tf = p->p_md.md_regs;
/*
* The trampoline code hands us the context.