summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authortakawata <takawata@FreeBSD.org>2000-09-26 05:09:21 +0000
committertakawata <takawata@FreeBSD.org>2000-09-26 05:09:21 +0000
commit0f805a3db68df9be0cf44fe672cfe469d927b55b (patch)
treea179118e65055cf6100d8cdb6e01d89e1705e01e /sys/kern
parent56f952fed7d1e2f4a90334d640e2d869d7fd303d (diff)
downloadFreeBSD-src-0f805a3db68df9be0cf44fe672cfe469d927b55b.zip
FreeBSD-src-0f805a3db68df9be0cf44fe672cfe469d927b55b.tar.gz
Make size of dynamic loader argument variable to support
various executable file format. Reviewed by: peter
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exec.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index d4f2b48..3403e2f 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -128,6 +128,7 @@ execve(p, uap)
imgp->vp = NULL;
imgp->firstpage = NULL;
imgp->ps_strings = 0;
+ imgp->auxarg_size = 0;
/*
* Allocate temporary demand zeroed space for argument and
@@ -614,21 +615,28 @@ exec_copyout_strings(imgp)
* If we have a valid auxargs ptr, prepare some room
* on the stack.
*/
- if (imgp->auxargs)
- /*
- * The '+ 2' is for the null pointers at the end of each of the
- * arg and env vector sets, and 'AT_COUNT*2' is room for the
- * ELF Auxargs data.
- */
- vectp = (char **)(destp - (imgp->argc + imgp->envc + 2 +
- AT_COUNT*2) * sizeof(char*));
- else
- /*
- * The '+ 2' is for the null pointers at the end of each of the
- * arg and env vector sets
- */
+ if (imgp->auxargs) {
+ /*
+ * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for
+ * lower compatibility.
+ */
+ imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size
+ : (AT_COUNT * 2);
+ /*
+ * The '+ 2' is for the null pointers at the end of each of
+ * the arg and env vector sets,and imgp->auxarg_size is room
+ * for argument of Runtime loader.
+ */
+ vectp = (char **) (destp - (imgp->argc + imgp->envc + 2 +
+ imgp->auxarg_size) * sizeof(char *));
+
+ } else
+ /*
+ * The '+ 2' is for the null pointers at the end of each of
+ * the arg and env vector sets
+ */
vectp = (char **)
- (destp - (imgp->argc + imgp->envc + 2) * sizeof(char*));
+ (destp - (imgp->argc + imgp->envc + 2) * sizeof(char *));
/*
* vectp also becomes our initial stack base
OpenPOWER on IntegriCloud