diff options
-rw-r--r-- | sys/alpha/alpha/machdep.c | 11 | ||||
-rw-r--r-- | sys/alpha/alpha/trap.c | 13 | ||||
-rw-r--r-- | sys/alpha/alpha/vm_machdep.c | 57 | ||||
-rw-r--r-- | sys/alpha/linux/linux_sysvec.c | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 32 | ||||
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 57 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 15 | ||||
-rw-r--r-- | sys/conf/Makefile.i386 | 4 | ||||
-rw-r--r-- | sys/conf/Makefile.powerpc | 4 | ||||
-rw-r--r-- | sys/i386/conf/Makefile.i386 | 4 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 6 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 32 | ||||
-rw-r--r-- | sys/i386/i386/vm_machdep.c | 57 | ||||
-rw-r--r-- | sys/i386/linux/linux_misc.c | 15 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 19 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 32 | ||||
-rw-r--r-- | sys/powerpc/aim/vm_machdep.c | 57 | ||||
-rw-r--r-- | sys/powerpc/powerpc/vm_machdep.c | 57 | ||||
-rw-r--r-- | sys/vm/vm_mmap.c | 12 |
21 files changed, 26 insertions, 476 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index be36a26..9684309 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: machdep.c,v 1.36 1999/04/11 12:48:15 simokawa Exp $ + * $Id: machdep.c,v 1.37 1999/04/13 15:42:34 simokawa Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1300,14 +1300,6 @@ sendsig(sig_t catcher, int sig, int mask, u_long code) psp->ps_sigstk.ss_flags |= SS_ONSTACK; } else scp = (struct sigcontext *)(alpha_pal_rdusp() - rndfsize); -#ifndef VM_STACK - if ((u_long)scp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) -#if defined(UVM) - (void)uvm_grow(p, (u_long)scp); -#else - (void)grow(p, (u_long)scp); -#endif -#else /* Note: uvm_grow doesn't seem to be defined anywhere, so we don't * know how to implement it for the VM_STACK case. Also, we would * think that it would be wise to test for success of grow_stack, @@ -1315,7 +1307,6 @@ sendsig(sig_t catcher, int sig, int mask, u_long code) * non VM_STACK case. */ (void)grow_stack(p, (u_long)scp); -#endif #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid, diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index 2a91e7d..187b6a3 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -1,4 +1,4 @@ -/* $Id: trap.c,v 1.10 1998/12/30 10:38:58 dfr Exp $ */ +/* $Id: trap.c,v 1.11 1999/01/26 02:49:51 julian Exp $ */ /* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */ /* @@ -418,16 +418,6 @@ trap(a0, a1, a2, entry, framep) /* * Grow the stack if necessary */ -#ifndef VM_STACK - if ((caddr_t)va > vm->vm_maxsaddr - && va < USRSTACK) { - if (!grow(p, va)) { - rv = KERN_FAILURE; - --p->p_lock; - 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 @@ -439,7 +429,6 @@ trap(a0, a1, a2, entry, framep) --p->p_lock; goto nogo; } -#endif /* Fault in the user page: */ diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c index 658f730..37fce54 100644 --- a/sys/alpha/alpha/vm_machdep.c +++ b/sys/alpha/alpha/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.10 1999/02/08 00:47:32 dillon Exp $ + * $Id: vm_machdep.c,v 1.11 1999/02/08 02:42:12 dillon Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -365,60 +365,6 @@ cpu_reset() prom_halt(0); } -#ifndef VM_STACK -/* - * Grow the user stack to allow for 'sp'. This version grows the stack in - * chunks of SGROWSIZ. - */ -int -grow(p, sp) - struct proc *p; - size_t sp; -{ - unsigned int nss; - caddr_t v; - struct vmspace *vm = p->p_vmspace; - - if ((caddr_t)sp <= vm->vm_maxsaddr || sp >= USRSTACK) - return (1); - - nss = roundup(USRSTACK - sp, PAGE_SIZE); - - if (nss > p->p_rlimit[RLIMIT_STACK].rlim_cur) - return (0); - - if (vm->vm_ssize && roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) < nss) { - int grow_amount; - /* - * If necessary, grow the VM that the stack occupies - * to allow for the rlimit. This allows us to not have - * to allocate all of the VM up-front in execve (which - * is expensive). - * Grow the VM by the amount requested rounded up to - * the nearest SGROWSIZ to provide for some hysteresis. - */ - grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), SGROWSIZ); - v = (char *)USRSTACK - roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) - grow_amount; - /* - * If there isn't enough room to extend by SGROWSIZ, then - * just extend to the maximum size - */ - if (v < vm->vm_maxsaddr) { - v = vm->vm_maxsaddr; - grow_amount = MAXSSIZ - (vm->vm_ssize << PAGE_SHIFT); - } - if ((grow_amount == 0) || (vm_map_find(&vm->vm_map, NULL, 0, (vm_offset_t *)&v, - grow_amount, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0) != KERN_SUCCESS)) { - return (0); - } - vm->vm_ssize += grow_amount >> PAGE_SHIFT; - } - - return (1); -} -#else int grow_stack(p, sp) struct proc *p; @@ -432,7 +378,6 @@ grow_stack(p, sp) return (1); } -#endif static int cnt_prezero; diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c index 744719c..d3a2f71 100644 --- a/sys/alpha/linux/linux_sysvec.c +++ b/sys/alpha/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.44 1999/01/17 20:36:14 peter Exp $ + * $Id: linux_sysvec.c,v 1.45 1999/02/04 21:20:13 newton Exp $ */ /* XXX we use functions that might not exist. */ @@ -217,11 +217,7 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code) * and the stack can not be grown. useracc will return FALSE * if access is denied. */ -#ifdef VM_STACK if ((grow_stack (p, (int)fp) == FALSE) || -#else - if ((grow(p, (int)fp) == FALSE) || -#endif (useracc((caddr_t)fp, sizeof (struct linux_sigframe), B_WRITE) == FALSE)) { /* * Process has trashed its stack; give it an illegal diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 6980279..6ff8559 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.328 1999/04/03 22:19:58 jdp Exp $ + * $Id: machdep.c,v 1.329 1999/04/16 21:22:13 peter Exp $ */ #include "apm.h" @@ -537,11 +537,7 @@ sendsig(catcher, sig, mask, code) * and the stack can not be grown. useracc will return FALSE * if access is denied. */ -#ifdef VM_STACK if ((grow_stack (p, (int)fp) == FALSE) || -#else - if ((grow(p, (int)fp) == FALSE) || -#endif (useracc((caddr_t)fp, sizeof(struct sigframe), B_WRITE) == FALSE)) { /* * Process has trashed its stack; give it an illegal diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 4498e99..d08306e 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.133 1999/01/06 23:05:36 julian Exp $ + * $Id: trap.c,v 1.134 1999/03/09 20:20:09 phk Exp $ */ /* @@ -666,16 +666,6 @@ 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; - --p->p_lock; - 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 @@ -687,7 +677,6 @@ trap_pfault(frame, usermode, eva) --p->p_lock; goto nogo; } -#endif /* Fault in the user page: */ rv = vm_fault(map, va, ftype, @@ -791,15 +780,6 @@ 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; - --p->p_lock; - 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 @@ -811,7 +791,6 @@ trap_pfault(frame, usermode, eva) --p->p_lock; goto nogo; } -#endif /* Fault in the user page: */ rv = vm_fault(map, va, ftype, @@ -999,19 +978,10 @@ 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 diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 3ed436c..48a248f 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.119 1999/02/16 10:49:48 dfr Exp $ + * $Id: vm_machdep.c,v 1.120 1999/02/19 14:25:33 luoqi Exp $ */ #include "npx.h" @@ -507,60 +507,6 @@ cpu_reset_real() while(1); } -#ifndef VM_STACK -/* - * Grow the user stack to allow for 'sp'. This version grows the stack in - * chunks of SGROWSIZ. - */ -int -grow(p, sp) - struct proc *p; - u_int sp; -{ - unsigned int nss; - caddr_t v; - struct vmspace *vm = p->p_vmspace; - - if ((caddr_t)sp <= vm->vm_maxsaddr || sp >= USRSTACK) - return (1); - - nss = roundup(USRSTACK - sp, PAGE_SIZE); - - if (nss > p->p_rlimit[RLIMIT_STACK].rlim_cur) - return (0); - - if (vm->vm_ssize && roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) < nss) { - int grow_amount; - /* - * If necessary, grow the VM that the stack occupies - * to allow for the rlimit. This allows us to not have - * to allocate all of the VM up-front in execve (which - * is expensive). - * Grow the VM by the amount requested rounded up to - * the nearest SGROWSIZ to provide for some hysteresis. - */ - grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), SGROWSIZ); - v = (char *)USRSTACK - roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) - grow_amount; - /* - * If there isn't enough room to extend by SGROWSIZ, then - * just extend to the maximum size - */ - if (v < vm->vm_maxsaddr) { - v = vm->vm_maxsaddr; - grow_amount = MAXSSIZ - (vm->vm_ssize << PAGE_SHIFT); - } - if ((grow_amount == 0) || (vm_map_find(&vm->vm_map, NULL, 0, (vm_offset_t *)&v, - grow_amount, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0) != KERN_SUCCESS)) { - return (0); - } - vm->vm_ssize += grow_amount >> PAGE_SHIFT; - } - - return (1); -} -#else int grow_stack(p, sp) struct proc *p; @@ -574,7 +520,6 @@ grow_stack(p, sp) return (1); } -#endif SYSCTL_DECL(_vm_stats_misc); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 7668454..4ba58ad 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.52 1999/01/26 02:38:10 julian Exp $ + * $Id: linux_misc.c,v 1.53 1999/03/02 00:28:07 julian Exp $ */ #include <sys/param.h> @@ -669,21 +669,8 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args) bsd_args.flags |= MAP_FIXED; if (linux_args.flags & LINUX_MAP_ANON) bsd_args.flags |= MAP_ANON; - -#ifndef VM_STACK - /* Linux Threads will map into the proc stack space, unless - * we prevent it. This causes problems if we're not using - * our VM_STACK options. - */ - if ((unsigned int)linux_args.addr + linux_args.len > (USRSTACK - MAXSSIZ)) - return (EINVAL); -#endif - if (linux_args.flags & LINUX_MAP_GROWSDOWN) { - -#ifdef VM_STACK bsd_args.flags |= MAP_STACK; -#endif /* The linux MAP_GROWSDOWN option does not limit auto * growth of the region. Linux mmap with this option diff --git a/sys/conf/Makefile.i386 b/sys/conf/Makefile.i386 index cf6a212..fa0c04a 100644 --- a/sys/conf/Makefile.i386 +++ b/sys/conf/Makefile.i386 @@ -1,7 +1,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.i386,v 1.145 1999/04/15 14:52:23 bde Exp $ +# $Id: Makefile.i386,v 1.146 1999/04/16 21:22:09 peter Exp $ # # Makefile for FreeBSD # @@ -38,7 +38,7 @@ INCLUDES+= -I$S/../include .else INCLUDES+= -I/usr/include .endif -COPTS= ${INCLUDES} ${IDENT} -DKERNEL -DVM_STACK -include opt_global.h +COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} # XXX LOCORE means "don't declare C stuff" not "for locore.s". diff --git a/sys/conf/Makefile.powerpc b/sys/conf/Makefile.powerpc index cf6a212..fa0c04a 100644 --- a/sys/conf/Makefile.powerpc +++ b/sys/conf/Makefile.powerpc @@ -1,7 +1,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.i386,v 1.145 1999/04/15 14:52:23 bde Exp $ +# $Id: Makefile.i386,v 1.146 1999/04/16 21:22:09 peter Exp $ # # Makefile for FreeBSD # @@ -38,7 +38,7 @@ INCLUDES+= -I$S/../include .else INCLUDES+= -I/usr/include .endif -COPTS= ${INCLUDES} ${IDENT} -DKERNEL -DVM_STACK -include opt_global.h +COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} # XXX LOCORE means "don't declare C stuff" not "for locore.s". diff --git a/sys/i386/conf/Makefile.i386 b/sys/i386/conf/Makefile.i386 index cf6a212..fa0c04a 100644 --- a/sys/i386/conf/Makefile.i386 +++ b/sys/i386/conf/Makefile.i386 @@ -1,7 +1,7 @@ # Makefile.i386 -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $Id: Makefile.i386,v 1.145 1999/04/15 14:52:23 bde Exp $ +# $Id: Makefile.i386,v 1.146 1999/04/16 21:22:09 peter Exp $ # # Makefile for FreeBSD # @@ -38,7 +38,7 @@ INCLUDES+= -I$S/../include .else INCLUDES+= -I/usr/include .endif -COPTS= ${INCLUDES} ${IDENT} -DKERNEL -DVM_STACK -include opt_global.h +COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} # XXX LOCORE means "don't declare C stuff" not "for locore.s". diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 6980279..6ff8559 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.328 1999/04/03 22:19:58 jdp Exp $ + * $Id: machdep.c,v 1.329 1999/04/16 21:22:13 peter Exp $ */ #include "apm.h" @@ -537,11 +537,7 @@ sendsig(catcher, sig, mask, code) * and the stack can not be grown. useracc will return FALSE * if access is denied. */ -#ifdef VM_STACK if ((grow_stack (p, (int)fp) == FALSE) || -#else - if ((grow(p, (int)fp) == FALSE) || -#endif (useracc((caddr_t)fp, sizeof(struct sigframe), B_WRITE) == FALSE)) { /* * Process has trashed its stack; give it an illegal diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 4498e99..d08306e 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.133 1999/01/06 23:05:36 julian Exp $ + * $Id: trap.c,v 1.134 1999/03/09 20:20:09 phk Exp $ */ /* @@ -666,16 +666,6 @@ 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; - --p->p_lock; - 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 @@ -687,7 +677,6 @@ trap_pfault(frame, usermode, eva) --p->p_lock; goto nogo; } -#endif /* Fault in the user page: */ rv = vm_fault(map, va, ftype, @@ -791,15 +780,6 @@ 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; - --p->p_lock; - 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 @@ -811,7 +791,6 @@ trap_pfault(frame, usermode, eva) --p->p_lock; goto nogo; } -#endif /* Fault in the user page: */ rv = vm_fault(map, va, ftype, @@ -999,19 +978,10 @@ 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 diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 3ed436c..48a248f 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.119 1999/02/16 10:49:48 dfr Exp $ + * $Id: vm_machdep.c,v 1.120 1999/02/19 14:25:33 luoqi Exp $ */ #include "npx.h" @@ -507,60 +507,6 @@ cpu_reset_real() while(1); } -#ifndef VM_STACK -/* - * Grow the user stack to allow for 'sp'. This version grows the stack in - * chunks of SGROWSIZ. - */ -int -grow(p, sp) - struct proc *p; - u_int sp; -{ - unsigned int nss; - caddr_t v; - struct vmspace *vm = p->p_vmspace; - - if ((caddr_t)sp <= vm->vm_maxsaddr || sp >= USRSTACK) - return (1); - - nss = roundup(USRSTACK - sp, PAGE_SIZE); - - if (nss > p->p_rlimit[RLIMIT_STACK].rlim_cur) - return (0); - - if (vm->vm_ssize && roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) < nss) { - int grow_amount; - /* - * If necessary, grow the VM that the stack occupies - * to allow for the rlimit. This allows us to not have - * to allocate all of the VM up-front in execve (which - * is expensive). - * Grow the VM by the amount requested rounded up to - * the nearest SGROWSIZ to provide for some hysteresis. - */ - grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), SGROWSIZ); - v = (char *)USRSTACK - roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) - grow_amount; - /* - * If there isn't enough room to extend by SGROWSIZ, then - * just extend to the maximum size - */ - if (v < vm->vm_maxsaddr) { - v = vm->vm_maxsaddr; - grow_amount = MAXSSIZ - (vm->vm_ssize << PAGE_SHIFT); - } - if ((grow_amount == 0) || (vm_map_find(&vm->vm_map, NULL, 0, (vm_offset_t *)&v, - grow_amount, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0) != KERN_SUCCESS)) { - return (0); - } - vm->vm_ssize += grow_amount >> PAGE_SHIFT; - } - - return (1); -} -#else int grow_stack(p, sp) struct proc *p; @@ -574,7 +520,6 @@ grow_stack(p, sp) return (1); } -#endif SYSCTL_DECL(_vm_stats_misc); diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index 7668454..4ba58ad 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.52 1999/01/26 02:38:10 julian Exp $ + * $Id: linux_misc.c,v 1.53 1999/03/02 00:28:07 julian Exp $ */ #include <sys/param.h> @@ -669,21 +669,8 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args) bsd_args.flags |= MAP_FIXED; if (linux_args.flags & LINUX_MAP_ANON) bsd_args.flags |= MAP_ANON; - -#ifndef VM_STACK - /* Linux Threads will map into the proc stack space, unless - * we prevent it. This causes problems if we're not using - * our VM_STACK options. - */ - if ((unsigned int)linux_args.addr + linux_args.len > (USRSTACK - MAXSSIZ)) - return (EINVAL); -#endif - if (linux_args.flags & LINUX_MAP_GROWSDOWN) { - -#ifdef VM_STACK bsd_args.flags |= MAP_STACK; -#endif /* The linux MAP_GROWSDOWN option does not limit auto * growth of the region. Linux mmap with this option diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 744719c..d3a2f71 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_sysvec.c,v 1.44 1999/01/17 20:36:14 peter Exp $ + * $Id: linux_sysvec.c,v 1.45 1999/02/04 21:20:13 newton Exp $ */ /* XXX we use functions that might not exist. */ @@ -217,11 +217,7 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code) * and the stack can not be grown. useracc will return FALSE * if access is denied. */ -#ifdef VM_STACK if ((grow_stack (p, (int)fp) == FALSE) || -#else - if ((grow(p, (int)fp) == FALSE) || -#endif (useracc((caddr_t)fp, sizeof (struct linux_sigframe), B_WRITE) == FALSE)) { /* * Process has trashed its stack; give it an illegal diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index c96055d..9e85104 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_exec.c,v 1.96 1999/02/19 14:25:34 luoqi Exp $ + * $Id: kern_exec.c,v 1.97 1999/04/03 22:20:01 jdp Exp $ */ #include <sys/param.h> @@ -428,11 +428,7 @@ exec_new_vmspace(imgp) { int error; struct vmspace *vmspace = imgp->proc->p_vmspace; -#ifdef VM_STACK caddr_t stack_addr = (caddr_t) (USRSTACK - MAXSSIZ); -#else - caddr_t stack_addr = (caddr_t) (USRSTACK - SGROWSIZ); -#endif vm_map_t map = &vmspace->vm_map; imgp->vmspace_destroyed = 1; @@ -454,7 +450,6 @@ exec_new_vmspace(imgp) } /* Allocate a new stack */ -#ifdef VM_STACK error = vm_map_stack (&vmspace->vm_map, (vm_offset_t)stack_addr, (vm_size_t)MAXSSIZ, VM_PROT_ALL, VM_PROT_ALL, 0); if (error) @@ -466,18 +461,6 @@ exec_new_vmspace(imgp) */ vmspace->vm_ssize = SGROWSIZ >> PAGE_SHIFT; vmspace->vm_maxsaddr = (char *)USRSTACK - MAXSSIZ; -#else - error = vm_map_insert(&vmspace->vm_map, NULL, 0, - (vm_offset_t) stack_addr, (vm_offset_t) USRSTACK, - VM_PROT_ALL, VM_PROT_ALL, 0); - if (error) - return (error); - - vmspace->vm_ssize = SGROWSIZ >> PAGE_SHIFT; - - /* Initialize maximum stack address */ - vmspace->vm_maxsaddr = (char *)USRSTACK - MAXSSIZ; -#endif return(0); } diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 4498e99..d08306e 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.133 1999/01/06 23:05:36 julian Exp $ + * $Id: trap.c,v 1.134 1999/03/09 20:20:09 phk Exp $ */ /* @@ -666,16 +666,6 @@ 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; - --p->p_lock; - 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 @@ -687,7 +677,6 @@ trap_pfault(frame, usermode, eva) --p->p_lock; goto nogo; } -#endif /* Fault in the user page: */ rv = vm_fault(map, va, ftype, @@ -791,15 +780,6 @@ 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; - --p->p_lock; - 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 @@ -811,7 +791,6 @@ trap_pfault(frame, usermode, eva) --p->p_lock; goto nogo; } -#endif /* Fault in the user page: */ rv = vm_fault(map, va, ftype, @@ -999,19 +978,10 @@ 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 diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c index 658f730..37fce54 100644 --- a/sys/powerpc/aim/vm_machdep.c +++ b/sys/powerpc/aim/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.10 1999/02/08 00:47:32 dillon Exp $ + * $Id: vm_machdep.c,v 1.11 1999/02/08 02:42:12 dillon Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -365,60 +365,6 @@ cpu_reset() prom_halt(0); } -#ifndef VM_STACK -/* - * Grow the user stack to allow for 'sp'. This version grows the stack in - * chunks of SGROWSIZ. - */ -int -grow(p, sp) - struct proc *p; - size_t sp; -{ - unsigned int nss; - caddr_t v; - struct vmspace *vm = p->p_vmspace; - - if ((caddr_t)sp <= vm->vm_maxsaddr || sp >= USRSTACK) - return (1); - - nss = roundup(USRSTACK - sp, PAGE_SIZE); - - if (nss > p->p_rlimit[RLIMIT_STACK].rlim_cur) - return (0); - - if (vm->vm_ssize && roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) < nss) { - int grow_amount; - /* - * If necessary, grow the VM that the stack occupies - * to allow for the rlimit. This allows us to not have - * to allocate all of the VM up-front in execve (which - * is expensive). - * Grow the VM by the amount requested rounded up to - * the nearest SGROWSIZ to provide for some hysteresis. - */ - grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), SGROWSIZ); - v = (char *)USRSTACK - roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) - grow_amount; - /* - * If there isn't enough room to extend by SGROWSIZ, then - * just extend to the maximum size - */ - if (v < vm->vm_maxsaddr) { - v = vm->vm_maxsaddr; - grow_amount = MAXSSIZ - (vm->vm_ssize << PAGE_SHIFT); - } - if ((grow_amount == 0) || (vm_map_find(&vm->vm_map, NULL, 0, (vm_offset_t *)&v, - grow_amount, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0) != KERN_SUCCESS)) { - return (0); - } - vm->vm_ssize += grow_amount >> PAGE_SHIFT; - } - - return (1); -} -#else int grow_stack(p, sp) struct proc *p; @@ -432,7 +378,6 @@ grow_stack(p, sp) return (1); } -#endif static int cnt_prezero; diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c index 658f730..37fce54 100644 --- a/sys/powerpc/powerpc/vm_machdep.c +++ b/sys/powerpc/powerpc/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.10 1999/02/08 00:47:32 dillon Exp $ + * $Id: vm_machdep.c,v 1.11 1999/02/08 02:42:12 dillon Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -365,60 +365,6 @@ cpu_reset() prom_halt(0); } -#ifndef VM_STACK -/* - * Grow the user stack to allow for 'sp'. This version grows the stack in - * chunks of SGROWSIZ. - */ -int -grow(p, sp) - struct proc *p; - size_t sp; -{ - unsigned int nss; - caddr_t v; - struct vmspace *vm = p->p_vmspace; - - if ((caddr_t)sp <= vm->vm_maxsaddr || sp >= USRSTACK) - return (1); - - nss = roundup(USRSTACK - sp, PAGE_SIZE); - - if (nss > p->p_rlimit[RLIMIT_STACK].rlim_cur) - return (0); - - if (vm->vm_ssize && roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) < nss) { - int grow_amount; - /* - * If necessary, grow the VM that the stack occupies - * to allow for the rlimit. This allows us to not have - * to allocate all of the VM up-front in execve (which - * is expensive). - * Grow the VM by the amount requested rounded up to - * the nearest SGROWSIZ to provide for some hysteresis. - */ - grow_amount = roundup((nss - (vm->vm_ssize << PAGE_SHIFT)), SGROWSIZ); - v = (char *)USRSTACK - roundup(vm->vm_ssize << PAGE_SHIFT, - SGROWSIZ) - grow_amount; - /* - * If there isn't enough room to extend by SGROWSIZ, then - * just extend to the maximum size - */ - if (v < vm->vm_maxsaddr) { - v = vm->vm_maxsaddr; - grow_amount = MAXSSIZ - (vm->vm_ssize << PAGE_SHIFT); - } - if ((grow_amount == 0) || (vm_map_find(&vm->vm_map, NULL, 0, (vm_offset_t *)&v, - grow_amount, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0) != KERN_SUCCESS)) { - return (0); - } - vm->vm_ssize += grow_amount >> PAGE_SHIFT; - } - - return (1); -} -#else int grow_stack(p, sp) struct proc *p; @@ -432,7 +378,6 @@ grow_stack(p, sp) return (1); } -#endif static int cnt_prezero; diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 974fd00..0931504 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -38,7 +38,7 @@ * from: Utah $Hdr: vm_mmap.c 1.6 91/10/21$ * * @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94 - * $Id: vm_mmap.c,v 1.91 1999/03/01 20:42:16 alc Exp $ + * $Id: vm_mmap.c,v 1.92 1999/03/02 22:55:02 alc Exp $ */ /* @@ -179,15 +179,11 @@ mmap(p, uap) return (EINVAL); if (flags & MAP_STACK) { -#ifdef VM_STACK if ((uap->fd != -1) || ((prot & (PROT_READ | PROT_WRITE)) != (PROT_READ | PROT_WRITE))) return (EINVAL); flags |= MAP_ANON; pos = 0; -#else - return (EINVAL); -#endif } /* @@ -1058,14 +1054,12 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot, *addr = pmap_addr_hint(object, *addr, size); } -#ifdef VM_STACK if (flags & MAP_STACK) rv = vm_map_stack (map, *addr, size, prot, maxprot, docow); else -#endif - rv = vm_map_find(map, object, foff, addr, size, fitit, - prot, maxprot, docow); + rv = vm_map_find(map, object, foff, addr, size, fitit, + prot, maxprot, docow); if (rv != KERN_SUCCESS) { /* |