summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1999-12-27 10:42:55 +0000
committerbde <bde@FreeBSD.org>1999-12-27 10:42:55 +0000
commite449cadeebe209e353673443b2e57095d8910581 (patch)
treeaed6e47c2205ca5b6d68b61f8d8e092bd3284fd7
parentdc68d5537abe5fbecd1144ef0ff8ba033aeede78 (diff)
downloadFreeBSD-src-e449cadeebe209e353673443b2e57095d8910581.zip
FreeBSD-src-e449cadeebe209e353673443b2e57095d8910581.tar.gz
Changed the type used to represent the user stack pointer from `long *'
to `register_t *'. This fixes bugs like misplacement of argc and argv on the user stack on i386's with 64-bit longs. We still use longs to represent "words" like argc and argv, and assume that they are on the stack (and that there is stack). The suword() and fuword() families should also use register_t.
-rw-r--r--sys/alpha/linux/linux_sysvec.c12
-rw-r--r--sys/i386/linux/linux_sysvec.c12
-rw-r--r--sys/kern/imgact_elf.c6
-rw-r--r--sys/kern/kern_exec.c10
4 files changed, 20 insertions, 20 deletions
diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c
index 76be2b4..39f3000 100644
--- a/sys/alpha/linux/linux_sysvec.c
+++ b/sys/alpha/linux/linux_sysvec.c
@@ -66,9 +66,9 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
extern struct linker_set linux_ioctl_handler_set;
-static int linux_fixup __P((long **stack_base,
+static int linux_fixup __P((register_t **stack_base,
struct image_params *iparams));
-static int elf_linux_fixup __P((long **stack_base,
+static int elf_linux_fixup __P((register_t **stack_base,
struct image_params *iparams));
static void linux_prepsyscall __P((struct trapframe *tf, int *args,
u_int *code, caddr_t *params));
@@ -133,9 +133,9 @@ translate_traps(int signal, int trap_code)
}
static int
-linux_fixup(long **stack_base, struct image_params *imgp)
+linux_fixup(register_t **stack_base, struct image_params *imgp)
{
- long *argv, *envp;
+ register_t *argv, *envp;
argv = *stack_base;
envp = *stack_base + (imgp->argc + 1);
@@ -149,10 +149,10 @@ linux_fixup(long **stack_base, struct image_params *imgp)
}
static int
-elf_linux_fixup(long **stack_base, struct image_params *imgp)
+elf_linux_fixup(register_t **stack_base, struct image_params *imgp)
{
Elf32_Auxargs *args = (Elf32_Auxargs *)imgp->auxargs;
- long *pos;
+ register_t *pos;
pos = *stack_base + (imgp->argc + imgp->envc + 2);
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 76be2b4..39f3000 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -66,9 +66,9 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
extern struct linker_set linux_ioctl_handler_set;
-static int linux_fixup __P((long **stack_base,
+static int linux_fixup __P((register_t **stack_base,
struct image_params *iparams));
-static int elf_linux_fixup __P((long **stack_base,
+static int elf_linux_fixup __P((register_t **stack_base,
struct image_params *iparams));
static void linux_prepsyscall __P((struct trapframe *tf, int *args,
u_int *code, caddr_t *params));
@@ -133,9 +133,9 @@ translate_traps(int signal, int trap_code)
}
static int
-linux_fixup(long **stack_base, struct image_params *imgp)
+linux_fixup(register_t **stack_base, struct image_params *imgp)
{
- long *argv, *envp;
+ register_t *argv, *envp;
argv = *stack_base;
envp = *stack_base + (imgp->argc + 1);
@@ -149,10 +149,10 @@ linux_fixup(long **stack_base, struct image_params *imgp)
}
static int
-elf_linux_fixup(long **stack_base, struct image_params *imgp)
+elf_linux_fixup(register_t **stack_base, struct image_params *imgp)
{
Elf32_Auxargs *args = (Elf32_Auxargs *)imgp->auxargs;
- long *pos;
+ register_t *pos;
pos = *stack_base + (imgp->argc + imgp->envc + 2);
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index c541147..45d33df 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -69,7 +69,7 @@ __ElfType(Brandinfo);
__ElfType(Auxargs);
static int elf_check_header __P((const Elf_Ehdr *hdr));
-static int elf_freebsd_fixup __P((long **stack_base,
+static int elf_freebsd_fixup __P((register_t **stack_base,
struct image_params *imgp));
static int elf_load_file __P((struct proc *p, const char *file, u_long *addr,
u_long *entry));
@@ -622,10 +622,10 @@ fail:
}
static int
-elf_freebsd_fixup(long **stack_base, struct image_params *imgp)
+elf_freebsd_fixup(register_t **stack_base, struct image_params *imgp)
{
Elf_Auxargs *args = (Elf_Auxargs *)imgp->auxargs;
- long *pos;
+ register_t *pos;
pos = *stack_base + (imgp->argc + imgp->envc + 2);
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 60c7f55..cceadb1 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -65,7 +65,7 @@
MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments");
-static long *exec_copyout_strings __P((struct image_params *));
+static register_t *exec_copyout_strings __P((struct image_params *));
static long ps_strings = PS_STRINGS;
SYSCTL_LONG(_kern, KERN_PS_STRINGS, ps_strings, CTLFLAG_RD, &ps_strings, "");
@@ -103,7 +103,7 @@ execve(p, uap)
register struct execve_args *uap;
{
struct nameidata nd, *ndp;
- long *stack_base;
+ register_t *stack_base;
int error, len, i;
struct image_params image_params, *imgp;
struct vattr attr;
@@ -567,14 +567,14 @@ exec_extract_strings(imgp)
* new arg and env vector tables. Return a pointer to the base
* so that it can be used as the initial stack pointer.
*/
-long *
+register_t *
exec_copyout_strings(imgp)
struct image_params *imgp;
{
int argc, envc;
char **vectp;
char *stringp, *destp;
- long *stack_base;
+ register_t *stack_base;
struct ps_strings *arginfo;
int szsigcode;
@@ -617,7 +617,7 @@ exec_copyout_strings(imgp)
/*
* vectp also becomes our initial stack base
*/
- stack_base = (long *)vectp;
+ stack_base = (register_t *)vectp;
stringp = imgp->stringbase;
argc = imgp->argc;
OpenPOWER on IntegriCloud