summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-19 00:57:08 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-12-19 00:57:08 +0000
commit1b7ddb41b21f0c8452473165039535afb6d4c81b (patch)
tree7eb343efebe95101103f84631239b18d0cf09c30
parent99bbda49e05021a1d49959bc718ff27b571fc232 (diff)
simplify stack grownups (growndowns are not touched)
-rw-r--r--sys/kern/exec_subr.c13
-rw-r--r--sys/kern/init_main.c6
-rw-r--r--sys/uvm/uvm_unix.c4
3 files changed, 10 insertions, 13 deletions
diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c
index a4e64f3994a..7b0ba7b6da6 100644
--- a/sys/kern/exec_subr.c
+++ b/sys/kern/exec_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_subr.c,v 1.23 2002/11/06 00:17:28 art Exp $ */
+/* $OpenBSD: exec_subr.c,v 1.24 2002/12/19 00:57:07 mickey Exp $ */
/* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */
/*
@@ -317,11 +317,12 @@ exec_setup_stack(p, epp)
{
#ifdef MACHINE_STACK_GROWS_UP
- epp->ep_maxsaddr = USRSTACK + MAXSSIZ;
+ epp->ep_maxsaddr = USRSTACK;
+ epp->ep_minsaddr = USRSTACK + MAXSSIZ;
#else
epp->ep_maxsaddr = USRSTACK - MAXSSIZ;
-#endif
epp->ep_minsaddr = USRSTACK;
+#endif
epp->ep_ssize = round_page(p->p_rlimit[RLIMIT_STACK].rlim_cur);
/*
@@ -337,10 +338,10 @@ exec_setup_stack(p, epp)
*/
#ifdef MACHINE_STACK_GROWS_UP
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
- (epp->ep_maxsaddr - (epp->ep_minsaddr + epp->ep_ssize)),
- epp->ep_minsaddr + epp->ep_ssize, NULLVP, 0, VM_PROT_NONE);
+ ((epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr),
+ epp->ep_maxsaddr + epp->ep_ssize, NULLVP, 0, VM_PROT_NONE);
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, epp->ep_ssize,
- epp->ep_minsaddr, NULLVP, 0,
+ epp->ep_maxsaddr, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE);
#else
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index b0da2724f27..709b1d1cf21 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.97 2002/11/22 16:47:28 art Exp $ */
+/* $OpenBSD: init_main.c,v 1.98 2002/12/19 00:57:07 mickey Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -505,11 +505,7 @@ start_init(arg)
UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
UVM_ADV_NORMAL, UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)))
panic("init: couldn't allocate argument space");
-#ifdef MACHINE_STACK_GROWS_UP
- p->p_vmspace->vm_maxsaddr = (caddr_t)addr + PAGE_SIZE;
-#else
p->p_vmspace->vm_maxsaddr = (caddr_t)addr;
-#endif
for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) {
#ifdef MACHINE_STACK_GROWS_UP
diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c
index fa1a212f406..ec01e186ed0 100644
--- a/sys/uvm/uvm_unix.c
+++ b/sys/uvm/uvm_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_unix.c,v 1.22 2002/10/29 18:30:21 art Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.23 2002/12/19 00:57:07 mickey Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
@@ -128,7 +128,7 @@ uvm_grow(p, sp)
* For user defined stacks (from sendsig).
*/
#ifdef MACHINE_STACK_GROWS_UP
- if (sp > (vaddr_t)vm->vm_maxsaddr)
+ if (sp > (vaddr_t)vm->vm_minsaddr)
#else
if (sp < (vaddr_t)vm->vm_maxsaddr)
#endif