summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/trap.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1999-01-06 23:05:42 +0000
committerjulian <julian@FreeBSD.org>1999-01-06 23:05:42 +0000
commit4666ac50272776168d29d2c4142de771daa30381 (patch)
tree132bbd3c7ed8de9adf36dcd6258013de903e583a /sys/amd64/amd64/trap.c
parent6b0a11c013bb11bbed19aea0a563ebb393a899ef (diff)
downloadFreeBSD-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/amd64/amd64/trap.c')
-rw-r--r--sys/amd64/amd64/trap.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index e672368..42b0c85 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/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
OpenPOWER on IntegriCloud