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/kern_exec.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/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index fc23c6e..dd63672 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.91 1998/12/27 18:03:29 dfr Exp $ + * $Id: kern_exec.c,v 1.92 1998/12/30 10:38:59 dfr Exp $ */ #include <sys/param.h> @@ -426,7 +426,11 @@ 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; @@ -448,6 +452,19 @@ 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) + return (error); + + /* vm_ssize and vm_maxsaddr are somewhat antiquated concepts in the + * VM_STACK case, but they are still used to monitor the size of the + * process stack so we can check the stack rlimit. + */ + 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); @@ -458,6 +475,7 @@ exec_new_vmspace(imgp) /* Initialize maximum stack address */ vmspace->vm_maxsaddr = (char *)USRSTACK - MAXSSIZ; +#endif return(0); } |