Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 copy exec_aout.c:exec_aout_setup_stack t...
details: https://anonhg.NetBSD.org/src/rev/d6be08f49cac
branches: trunk
changeset: 500773:d6be08f49cac
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Dec 18 14:50:04 2000 +0000
description:
copy exec_aout.c:exec_aout_setup_stack to netbsd32_exec_aout_setup_stack,
but use USRSTACK32 not USRSTACK, so that we get 32-bit stack addresses.
now 32 bit a.out binaries work on sparc64.
diffstat:
sys/compat/netbsd32/netbsd32_exec_aout.c | 57 ++++++++++++++++++++++++++++---
1 files changed, 50 insertions(+), 7 deletions(-)
diffs (92 lines):
diff -r bd3d31152f30 -r d6be08f49cac sys/compat/netbsd32/netbsd32_exec_aout.c
--- a/sys/compat/netbsd32/netbsd32_exec_aout.c Mon Dec 18 14:48:26 2000 +0000
+++ b/sys/compat/netbsd32/netbsd32_exec_aout.c Mon Dec 18 14:50:04 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_exec_aout.c,v 1.1 2000/12/01 21:51:09 jdolecek Exp $ */
+/* $NetBSD: netbsd32_exec_aout.c,v 1.2 2000/12/18 14:50:04 mrg Exp $ */
/* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */
/*
@@ -55,11 +55,13 @@
void *, size_t, const void *, const void *));
static int netbsd32_exec_aout_prep_zmagic __P((struct proc *,
- struct exec_package *));
+ struct exec_package *));
static int netbsd32_exec_aout_prep_nmagic __P((struct proc *,
- struct exec_package *));
+ struct exec_package *));
static int netbsd32_exec_aout_prep_omagic __P((struct proc *,
- struct exec_package *));
+ struct exec_package *));
+int netbsd32_exec_aout_setup_stack __P((struct proc *p,
+ struct exec_package *epp));
/*
* exec_netbsd32_makecmds(): Check if it's an netbsd32 a.out format
@@ -171,7 +173,7 @@
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 netbsd32_exec_aout_setup_stack(p, epp);
}
/*
@@ -210,7 +212,7 @@
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 netbsd32_exec_aout_setup_stack(p, epp);
}
/*
@@ -254,5 +256,46 @@
*/
dsize = epp->ep_dsize + execp->a_text - roundup(execp->a_text, NBPG);
epp->ep_dsize = (dsize > 0) ? dsize : 0;
- return exec_aout_setup_stack(p, epp);
+ return netbsd32_exec_aout_setup_stack(p, epp);
}
+
+/*
+ * netbsd32_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
+netbsd32_exec_aout_setup_stack(struct proc *p, struct exec_package *epp)
+{
+
+ epp->ep_maxsaddr = USRSTACK32 - MAXSSIZ;
+ epp->ep_minsaddr = USRSTACK32;
+ 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;
+}
Home |
Main Index |
Thread Index |
Old Index