diff options
author | dg <dg@FreeBSD.org> | 1994-11-06 04:46:53 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1994-11-06 04:46:53 +0000 |
commit | 0a030b255550a0113a1a9ef32e83ca3050ee2e2b (patch) | |
tree | 844962e17582d5800ba63526d6daee245ea655ce /sys/amd64 | |
parent | 6f05c1e02d5c64afc7ed9c69f6bb498af2776c01 (diff) | |
download | FreeBSD-src-0a030b255550a0113a1a9ef32e83ca3050ee2e2b.zip FreeBSD-src-0a030b255550a0113a1a9ef32e83ca3050ee2e2b.tar.gz |
Do a better job at preparing registers for the new process in setregs()
by setting them all to a known state.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 8dc1ac5..3dfaaec 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.85 1994/11/03 14:57:54 jkh Exp $ + * $Id: machdep.c,v 1.86 1994/11/06 01:33:03 bde Exp $ */ #include "npx.h" @@ -859,13 +859,16 @@ setregs(p, entry, stack) u_long entry; u_long stack; { - p->p_md.md_regs[tEBP] = 0; /* bottom of the fp chain */ - p->p_md.md_regs[tEIP] = entry; - p->p_md.md_regs[tESP] = stack; - p->p_md.md_regs[tSS] = _udatasel; - p->p_md.md_regs[tDS] = _udatasel; - p->p_md.md_regs[tES] = _udatasel; - p->p_md.md_regs[tCS] = _ucodesel; + int *regs = p->p_md.md_regs; + + bzero(regs, sizeof(struct trapframe)); + regs[tEIP] = entry; + regs[tESP] = stack; + regs[tEFLAGS] = PSL_USERSET | (regs[tEFLAGS] & PSL_T); + regs[tSS] = _udatasel; + regs[tDS] = _udatasel; + regs[tES] = _udatasel; + regs[tCS] = _ucodesel; p->p_addr->u_pcb.pcb_flags = 0; /* no fp at all */ load_cr0(rcr0() | CR0_TS); /* start emulating */ |