diff options
author | julian <julian@FreeBSD.org> | 1999-01-06 23:05:42 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1999-01-06 23:05:42 +0000 |
commit | 4666ac50272776168d29d2c4142de771daa30381 (patch) | |
tree | 132bbd3c7ed8de9adf36dcd6258013de903e583a /sys/kern/subr_trap.c | |
parent | 6b0a11c013bb11bbed19aea0a563ebb393a899ef (diff) | |
download | FreeBSD-src-4666ac50272776168d29d2c4142de771daa30381.zip FreeBSD-src-4666ac50272776168d29d2c4142de771daa30381.tar.gz |
Add (but don't activate) code for a special VM option to make
downward growing stacks more general.
Add (but don't activate) code to use the new stack facility
when running threads, (specifically the linux threads support).
This allows people to use both linux compiled linuxthreads, and also the
native FreeBSD linux-threads port.
The code is conditional on VM_STACK. Not using this will
produce the old heavily tested system.
Submitted by: Richard Seaman <dick@tar.com>
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r-- | sys/kern/subr_trap.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index e672368..42b0c85 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.131 1998/12/16 15:21:50 bde Exp $ + * $Id: trap.c,v 1.132 1998/12/28 23:02:56 msmith Exp $ */ /* @@ -665,6 +665,7 @@ trap_pfault(frame, usermode, eva) /* * Grow the stack if necessary */ +#ifndef VM_STACK if ((caddr_t)va > vm->vm_maxsaddr && va < USRSTACK) { if (!grow(p, va)) { rv = KERN_FAILURE; @@ -673,6 +674,20 @@ trap_pfault(frame, usermode, eva) } } +#else + /* grow_stack returns false only if va falls into + * a growable stack region and the stack growth + * fails. It returns true if va was not within + * a growable stack region, or if the stack + * growth succeeded. + */ + if (!grow_stack (p, va)) { + rv = KERN_FAILURE; + --p->p_lock; + goto nogo; + } +#endif + /* Fault in the user page: */ rv = vm_fault(map, va, ftype, (ftype & VM_PROT_WRITE) ? VM_FAULT_DIRTY : 0); @@ -775,6 +790,7 @@ trap_pfault(frame, usermode, eva) /* * Grow the stack if necessary */ +#ifndef VM_STACK if ((caddr_t)va > vm->vm_maxsaddr && va < USRSTACK) { if (!grow(p, va)) { rv = KERN_FAILURE; @@ -782,6 +798,19 @@ trap_pfault(frame, usermode, eva) goto nogo; } } +#else + /* grow_stack returns false only if va falls into + * a growable stack region and the stack growth + * fails. It returns true if va was not within + * a growable stack region, or if the stack + * growth succeeded. + */ + if (!grow_stack (p, va)) { + rv = KERN_FAILURE; + --p->p_lock; + goto nogo; + } +#endif /* Fault in the user page: */ rv = vm_fault(map, va, ftype, @@ -969,12 +998,19 @@ int trapwrite(addr) ++p->p_lock; +#ifndef VM_STACK if ((caddr_t)va >= vm->vm_maxsaddr && va < USRSTACK) { if (!grow(p, va)) { --p->p_lock; return (1); } } +#else + if (!grow_stack (p, va)) { + --p->p_lock; + return (1); + } +#endif /* * fault the data page |