summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_unix.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1999-07-20 11:10:55 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1999-07-20 11:10:55 +0000
commit04436769e9ffd0c9f179b586cd97bc446f2e5434 (patch)
tree3af5dba33099c030474dc23374919e5a4bb7d6be /sys/uvm/uvm_unix.c
parent4473a85d05b48539a5d4db04ae9384b5e4657f48 (diff)
accomodations for backward growing stack architectures; art@ k
Diffstat (limited to 'sys/uvm/uvm_unix.c')
-rw-r--r--sys/uvm/uvm_unix.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index 406a1dad197..1afa138a6b3 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.2 1999/02/26 05:32:08 art Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.3 1999/07/20 11:10:54 mickey Exp $ */
/* $NetBSD: uvm_unix.c,v 1.7 1998/10/11 23:18:21 chuck Exp $ */
/*
@@ -140,19 +140,31 @@ uvm_grow(p, sp)
/*
* For user defined stacks (from sendsig).
*/
+#ifdef MACHINE_STACK_GROWS_UP
+ if (sp > (vaddr_t)vm->vm_maxsaddr)
+#else
if (sp < (vaddr_t)vm->vm_maxsaddr)
+#endif
return (0);
/*
* For common case of already allocated (from trap).
*/
+#ifdef MACHINE_STACK_GROWS_UP
+ if (sp < USRSTACK + ctob(vm->vm_ssize))
+#else
if (sp >= USRSTACK - ctob(vm->vm_ssize))
+#endif
return (1);
/*
* Really need to check vs limit and increment stack size if ok.
*/
+#ifdef MACHINE_STACK_GROWS_UP
+ si = clrnd(btoc(sp - USRSTACK) - vm->vm_ssize);
+#else
si = clrnd(btoc(USRSTACK-sp) - vm->vm_ssize);
+#endif
if (vm->vm_ssize + si > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur))
return (0);
vm->vm_ssize += si;
@@ -220,9 +232,14 @@ uvm_coredump(p, vp, cred, chdr)
if (end > VM_MAXUSER_ADDRESS)
end = VM_MAXUSER_ADDRESS;
+#ifdef MACHINE_STACK_GROWS_UP
+ if (start >= USRSTACK) {
+ start = USRSTACK;
+#else
if (start >= (vaddr_t)vm->vm_maxsaddr) {
- flag = CORE_STACK;
start = trunc_page(USRSTACK - ctob(vm->vm_ssize));
+#endif
+ flag = CORE_STACK;
if (start >= end)
continue;
} else