summaryrefslogtreecommitdiff
path: root/sys/kern/exec_aout.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2003-08-08 18:53:13 +0000
committerchristos <christos@NetBSD.org>2003-08-08 18:53:13 +0000
commitc3c2f78f98001ca011760df367ca66c68ebc49fd (patch)
tree5705c196f22edd64d04679c31e511265589fd676 /sys/kern/exec_aout.c
parentfc27d910c0fe00c73bb11b931a5f29b17b45c602 (diff)
GC: exec_foo_setup_stack; use exec_setup_stack, and provide a way for
emulations to override it.
Diffstat (limited to 'sys/kern/exec_aout.c')
-rw-r--r--sys/kern/exec_aout.c52
1 files changed, 5 insertions, 47 deletions
diff --git a/sys/kern/exec_aout.c b/sys/kern/exec_aout.c
index 80f9e8bf947..7232b78de4e 100644
--- a/sys/kern/exec_aout.c
+++ b/sys/kern/exec_aout.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_aout.c,v 1.29 2003/06/29 22:31:15 fvdl Exp $ */
+/* $NetBSD: exec_aout.c,v 1.30 2003/08/08 18:53:13 christos Exp $ */
/*
* Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_aout.c,v 1.29 2003/06/29 22:31:15 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_aout.c,v 1.30 2003/08/08 18:53:13 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -134,7 +134,7 @@ exec_aout_prep_zmagic(struct proc *p, struct exec_package *epp)
epp->ep_daddr + execp->a_data, NULLVP, 0,
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
- return exec_aout_setup_stack(p, epp);
+ return (*epp->ep_esch->es_setup_stack)(p, epp);
}
/*
@@ -170,7 +170,7 @@ exec_aout_prep_nmagic(struct proc *p, struct exec_package *epp)
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, bsize, baddr,
NULLVP, 0, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
- return exec_aout_setup_stack(p, epp);
+ return (*epp->ep_esch->es_setup_stack)(p, epp);
}
/*
@@ -211,47 +211,5 @@ exec_aout_prep_omagic(struct proc *p, struct exec_package *epp)
*/
dsize = epp->ep_dsize + execp->a_text - round_page(execp->a_text);
epp->ep_dsize = (dsize > 0) ? dsize : 0;
- return exec_aout_setup_stack(p, epp);
-}
-
-/*
- * exec_aout_setup_stack(): Set up the stack segment for an a.out
- * executable.
- *
- * Note that the ep_ssize parameter must be set to be the current stack
- * limit; this is adjusted in the body of execve() to yield the
- * appropriate stack segment usage once the argument length is
- * calculated.
- *
- * This function returns an int for uniformity with other (future) formats'
- * stack setup functions. They might have errors to return.
- */
-
-int
-exec_aout_setup_stack(struct proc *p, struct exec_package *epp)
-{
-
- epp->ep_maxsaddr = USRSTACK - MAXSSIZ;
- epp->ep_minsaddr = USRSTACK;
- epp->ep_ssize = p->p_rlimit[RLIMIT_STACK].rlim_cur;
-
- /*
- * set up commands for stack. note that this takes *two*, one to
- * map the part of the stack which we can access, and one to map
- * the part which we can't.
- *
- * arguably, it could be made into one, but that would require the
- * addition of another mapping proc, which is unnecessary
- *
- * note that in memory, things assumed to be: 0 ... ep_maxsaddr
- * <stack> ep_minsaddr
- */
- NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero,
- ((epp->ep_minsaddr - epp->ep_ssize) - epp->ep_maxsaddr),
- epp->ep_maxsaddr, NULLVP, 0, VM_PROT_NONE);
- NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, epp->ep_ssize,
- (epp->ep_minsaddr - epp->ep_ssize), NULLVP, 0,
- VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
-
- return 0;
+ return (*epp->ep_esch->es_setup_stack)(p, epp);
}