diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2001-04-02 21:43:13 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2001-04-02 21:43:13 +0000 |
commit | af30415b0b2928465e43e6cf1262e7275d8dd1c5 (patch) | |
tree | c0943d31f2c4f5f6770363b2596da79e506bfc31 /sys/arch/i386 | |
parent | 92d3551f6f3379d9e9e7a6e3652ca50686373a1d (diff) |
On popular demand, the Linux-compatibility clone(2) implementation based
on NetBSD's code, as well as some faked Posix RT extensions by me. This makes
at least simple linuxthreads tests work.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/trap.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index c89e50ca3a3..7075ed44924 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.36 2001/03/22 23:36:51 niklas Exp $ */ +/* $OpenBSD: trap.c,v 1.37 2001/04/02 21:43:10 niklas Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ #undef DEBUG @@ -479,8 +479,16 @@ trap(frame) && map != kernel_map) { nss = clrnd(btoc(USRSTACK-(unsigned)va)); if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) { - rv = KERN_FAILURE; - goto nogo; + /* + * We used to fail here. However, it may + * just have been an mmap()ed page low + * in the stack, which is legal. If it + * wasn't, uvm_fault() will fail below. + * + * Set nss to 0, since this case is not + * a "stack extension". + */ + nss = 0; } } @@ -518,7 +526,9 @@ trap(frame) goto out; } +#ifndef PMAP_NEW nogo: +#endif if (type == T_PAGEFLT) { if (pcb->pcb_onfault != 0) goto copyfault; @@ -609,7 +619,7 @@ trapwrite(addr) if ((caddr_t)va >= vm->vm_maxsaddr) { nss = clrnd(btoc(USRSTACK-(unsigned)va)); if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) - return 1; + nss = 0; } #if defined(UVM) @@ -641,7 +651,7 @@ syscall(frame) register caddr_t params; register struct sysent *callp; register struct proc *p; - int error, opc, nsys; + int orig_error, error, opc, nsys; size_t argsize; register_t code, args[8], rval[2]; u_quad_t sticks; @@ -755,6 +765,7 @@ syscall(frame) error = copyin(params, (caddr_t)args, argsize); else error = 0; + orig_error = error; #ifdef SYSCALL_DEBUG scdebug_call(p, code, args); #endif @@ -766,7 +777,7 @@ syscall(frame) goto bad; rval[0] = 0; rval[1] = frame.tf_edx; - error = (*callp->sy_call)(p, args, rval); + orig_error = error = (*callp->sy_call)(p, args, rval); switch (error) { case 0: /* @@ -799,12 +810,12 @@ syscall(frame) } #ifdef SYSCALL_DEBUG - scdebug_ret(p, code, error, rval); + scdebug_ret(p, code, orig_error, rval); #endif userret(p, frame.tf_eip, sticks); #ifdef KTRACE if (KTRPOINT(p, KTR_SYSRET)) - ktrsysret(p, code, error, rval[0]); + ktrsysret(p, code, orig_error, rval[0]); #endif } |