Adjust to the new copyargs() footprint.

This commit is contained in:
christos 2001-07-29 21:28:45 +00:00
parent b474b9ac65
commit 934898bc32
17 changed files with 200 additions and 186 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec.h,v 1.3 2001/06/22 05:12:42 simonb Exp $ */ /* $NetBSD: linux_exec.h,v 1.4 2001/07/29 21:28:45 christos Exp $ */
/*- /*-
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -85,10 +85,12 @@ typedef struct {
#ifdef _KERNEL #ifdef _KERNEL
__BEGIN_DECLS __BEGIN_DECLS
#ifdef EXEC_ELF32 #ifdef EXEC_ELF32
void *linux_elf32_copyargs __P((struct exec_package *, struct ps_strings *, void *, void *)); int linux_elf32_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
#endif #endif
#ifdef EXEC_ELF64 #ifdef EXEC_ELF64
void *linux_elf64_copyargs __P((struct exec_package *, struct ps_strings *, void *, void *)); int linux_elf64_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
#endif #endif
__END_DECLS __END_DECLS
#endif /* !_KERNEL */ #endif /* !_KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_alpha.c,v 1.2 2001/01/18 17:48:04 tv Exp $ */ /* $NetBSD: linux_exec_alpha.c,v 1.3 2001/07/29 21:28:45 christos Exp $ */
#define ELFSIZE 64 #define ELFSIZE 64
@ -19,17 +19,17 @@
* XXX port. If so, move it to common/linux_exec_elf32.c * XXX port. If so, move it to common/linux_exec_elf32.c
* XXX included based on some define. * XXX included based on some define.
*/ */
void * int
ELFNAME2(linux,copyargs)(struct exec_package *pack, struct ps_strings *arginfo, ELFNAME2(linux,copyargs)(struct exec_package *pack, struct ps_strings *arginfo,
void *stack, void *argp) char **stackp, void *argp)
{ {
size_t len; size_t len;
LinuxAuxInfo ai[LINUX_ELF_AUX_ENTRIES], *a; LinuxAuxInfo ai[LINUX_ELF_AUX_ENTRIES], *a;
struct elf_args *ap; struct elf_args *ap;
int error;
stack = copyargs(pack, arginfo, stack, argp); if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
if (!stack) return error;
return(NULL);
memset(ai, 0, sizeof(LinuxAuxInfo) * LINUX_ELF_AUX_ENTRIES); memset(ai, 0, sizeof(LinuxAuxInfo) * LINUX_ELF_AUX_ENTRIES);
@ -104,9 +104,9 @@ ELFNAME2(linux,copyargs)(struct exec_package *pack, struct ps_strings *arginfo,
a++; a++;
len = (a - ai) * sizeof(LinuxAuxInfo); len = (a - ai) * sizeof(LinuxAuxInfo);
if (copyout(ai, stack, len)) if ((error = copyout(ai, *stackp, len)) != 0)
return NULL; return error;
stack = (caddr_t)stack + len; *stackp += len;
return(stack); return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec.h,v 1.3 2001/07/26 22:53:14 wiz Exp $ */ /* $NetBSD: linux_exec.h,v 1.4 2001/07/29 21:28:45 christos Exp $ */
/*- /*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -116,8 +116,8 @@ typedef struct {
#ifdef _KERNEL #ifdef _KERNEL
__BEGIN_DECLS __BEGIN_DECLS
void * linux_elf32_copyargs __P((struct exec_package *, int linux_elf32_copyargs __P((struct exec_package *,
struct ps_strings *, void *, void *)); struct ps_strings *, char **, void *));
__END_DECLS __END_DECLS
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_powerpc.c,v 1.3 2001/06/13 23:10:31 wiz Exp $ */ /* $NetBSD: linux_exec_powerpc.c,v 1.4 2001/07/29 21:28:45 christos Exp $ */
/*- /*-
* Copyright (c) 2001 The NetBSD Foundation, Inc. * Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -72,11 +72,11 @@ extern int linux_sp_wrap_entry;
/* /*
* Alpha and PowerPC specific linux copyargs function. * Alpha and PowerPC specific linux copyargs function.
*/ */
void * int
ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp) ELFNAME2(linux,copyargs)(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
size_t len; size_t len;
@ -88,6 +88,7 @@ ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
char linux_sp_wrap_code[LINUX_SP_WRAP]; char linux_sp_wrap_code[LINUX_SP_WRAP];
unsigned long* cga; unsigned long* cga;
#endif #endif
int error;
#ifdef LINUX_SHIFT #ifdef LINUX_SHIFT
/* /*
@ -95,12 +96,11 @@ ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
* aligned address. And we need one more 16 byte shift if it was already * aligned address. And we need one more 16 byte shift if it was already
* 16 bytes aligned, * 16 bytes aligned,
*/ */
(unsigned long)stack = ((unsigned long)stack - 1) & ~LINUX_SHIFT; *stackp = (char *)((unsigned long)*stackp - 1) & ~LINUX_SHIFT;
#endif #endif
stack = copyargs(pack, arginfo, stack, argp); if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
if (!stack) return error;
return(NULL);
#ifdef LINUX_SHIFT #ifdef LINUX_SHIFT
/* /*
@ -108,7 +108,8 @@ ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
* expects the ELF auxiliary table to start on a 16 bytes boundary on * expects the ELF auxiliary table to start on a 16 bytes boundary on
* the PowerPC. * the PowerPC.
*/ */
stack = (void *)(((unsigned long) stack + LINUX_SHIFT) & ~LINUX_SHIFT); *stackp = (char *)(((unsigned long)(*stackp) + LINUX_SHIFT)
& ~LINUX_SHIFT);
#endif #endif
memset(ai, 0, sizeof(LinuxAuxInfo) * LINUX_ELF_AUX_ENTRIES); memset(ai, 0, sizeof(LinuxAuxInfo) * LINUX_ELF_AUX_ENTRIES);
@ -205,20 +206,21 @@ ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
#ifdef LINUX_SP_WRAP #ifdef LINUX_SP_WRAP
if (prog_entry != NULL) if (prog_entry != NULL)
prog_entry->a_v = (unsigned long)stack + len; prog_entry->a_v = (unsigned long)(*stackp) + len;
#endif #endif
if (copyout(ai, stack, len)) if ((error = copyout(ai, *stackp, len)) != 0)
return NULL; return error;
stack = (caddr_t)stack + len; *stackp += len;
#ifdef LINUX_SP_WRAP #ifdef LINUX_SP_WRAP
if (prog_entry != NULL) { if (prog_entry != NULL) {
if (copyout(linux_sp_wrap_code, stack, LINUX_SP_WRAP)) if ((error = copyout(linux_sp_wrap_code, *stackp,
return NULL; LINUX_SP_WRAP)) != 0)
stack = (caddr_t)stack + LINUX_SP_WRAP; return error;
*stackp += LINUX_SP_WRAP;
} }
#endif #endif
return(stack); return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec.h,v 1.15 2001/06/18 02:00:53 christos Exp $ */ /* $NetBSD: linux_exec.h,v 1.16 2001/07/29 21:28:45 christos Exp $ */
/*- /*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -93,8 +93,8 @@ extern const struct emul emul_linux;
void linux_setregs __P((struct proc *, struct exec_package *, u_long)); void linux_setregs __P((struct proc *, struct exec_package *, u_long));
int exec_linux_aout_makecmds __P((struct proc *, struct exec_package *)); int exec_linux_aout_makecmds __P((struct proc *, struct exec_package *));
void *linux_aout_copyargs __P((struct exec_package *, int linux_aout_copyargs __P((struct exec_package *, struct ps_strings *,
struct ps_strings *, void *, void *)); char **, void *));
void linux_trapsignal __P((struct proc *, int, u_long)); void linux_trapsignal __P((struct proc *, int, u_long));
#ifdef EXEC_ELF32 #ifdef EXEC_ELF32

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_aout.c,v 1.44 2000/12/01 13:49:35 jdolecek Exp $ */ /* $NetBSD: linux_exec_aout.c,v 1.45 2001/07/29 21:28:46 christos Exp $ */
/*- /*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -66,40 +66,41 @@
#include <compat/linux/linux_syscallargs.h> #include <compat/linux/linux_syscallargs.h>
#include <compat/linux/linux_syscall.h> #include <compat/linux/linux_syscall.h>
void *linux_aout_copyargs __P((struct exec_package *, int linux_aout_copyargs __P((struct exec_package *, struct ps_strings *,
struct ps_strings *, void *, void *)); char **, void *));
static int exec_linux_aout_prep_zmagic __P((struct proc *, static int exec_linux_aout_prep_zmagic __P((struct proc *,
struct exec_package *)); struct exec_package *));
static int exec_linux_aout_prep_nmagic __P((struct proc *, static int exec_linux_aout_prep_nmagic __P((struct proc *,
struct exec_package *)); struct exec_package *));
static int exec_linux_aout_prep_omagic __P((struct proc *, static int exec_linux_aout_prep_omagic __P((struct proc *,
struct exec_package *)); struct exec_package *));
static int exec_linux_aout_prep_qmagic __P((struct proc *, static int exec_linux_aout_prep_qmagic __P((struct proc *,
struct exec_package *)); struct exec_package *));
void * int
linux_aout_copyargs(pack, arginfo, stack, argp) linux_aout_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
char **cpp = stack; char **cpp = (char **)*stackp;
char **stk = stack; char **stk = (char **)*stackp;
char *dp, *sp; char *dp, *sp;
size_t len; size_t len;
void *nullp = NULL; void *nullp = NULL;
int argc = arginfo->ps_nargvstr; int argc = arginfo->ps_nargvstr;
int envc = arginfo->ps_nenvstr; int envc = arginfo->ps_nenvstr;
int error;
if (copyout(&argc, cpp++, sizeof(argc))) if ((error = copyout(&argc, cpp++, sizeof(argc))) != 0)
return NULL; return error;
/* leave room for envp and argv */ /* leave room for envp and argv */
cpp += 2; cpp += 2;
if (copyout(&cpp, &stk[1], sizeof (cpp))) if ((error = copyout(&cpp, &stk[1], sizeof (cpp))) != 0)
return NULL; return error;
dp = (char *) (cpp + argc + envc + 2); dp = (char *) (cpp + argc + envc + 2);
sp = argp; sp = argp;
@ -108,27 +109,28 @@ linux_aout_copyargs(pack, arginfo, stack, argp)
arginfo->ps_argvstr = cpp; /* remember location of argv for later */ arginfo->ps_argvstr = cpp; /* remember location of argv for later */
for (; --argc >= 0; sp += len, dp += len) for (; --argc >= 0; sp += len, dp += len)
if (copyout(&dp, cpp++, sizeof(dp)) || if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
copyoutstr(sp, dp, ARG_MAX, &len)) (error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
return NULL; return error;
if (copyout(&nullp, cpp++, sizeof(nullp))) if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return NULL; return error;
if (copyout(&cpp, &stk[2], sizeof (cpp))) if ((error = copyout(&cpp, &stk[2], sizeof (cpp))) != 0)
return NULL; return error;
arginfo->ps_envstr = cpp; /* remember location of envp for later */ arginfo->ps_envstr = cpp; /* remember location of envp for later */
for (; --envc >= 0; sp += len, dp += len) for (; --envc >= 0; sp += len, dp += len)
if (copyout(&dp, cpp++, sizeof(dp)) || if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
copyoutstr(sp, dp, ARG_MAX, &len)) (error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
return NULL; return error;
if (copyout(&nullp, cpp++, sizeof(nullp))) if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return NULL; return error;
return cpp; *stackp = (char *)cpp;
return 0;
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_exec.h,v 1.8 2001/02/02 07:08:17 mrg Exp $ */ /* $NetBSD: netbsd32_exec.h,v 1.9 2001/07/29 21:28:46 christos Exp $ */
/* /*
* Copyright (c) 1998 Matthew R. Green * Copyright (c) 1998 Matthew R. Green
@ -61,59 +61,65 @@ int exec_netbsd32_makecmds __P((struct proc *, struct exec_package *));
#ifdef EXEC_ELF32 #ifdef EXEC_ELF32
int netbsd32_elf32_probe __P((struct proc *, struct exec_package *, void *, int netbsd32_elf32_probe __P((struct proc *, struct exec_package *, void *,
char *, vaddr_t *)); char *, vaddr_t *));
void *netbsd32_elf32_copyargs __P((struct exec_package *, struct ps_strings *, int netbsd32_elf32_copyargs __P((struct exec_package *, struct ps_strings *,
void *, void *)); char **, void *));
#endif /* EXEC_ELF32 */ #endif /* EXEC_ELF32 */
static __inline void *netbsd32_copyargs __P((struct exec_package *, static __inline int netbsd32_copyargs __P((struct exec_package *,
struct ps_strings *, void *, void *)); struct ps_strings *, char **, void *));
/* /*
* We need to copy out all pointers as 32-bit values. * We need to copy out all pointers as 32-bit values.
*/ */
static __inline void * static __inline int
netbsd32_copyargs(pack, arginfo, stack, argp) netbsd32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
u_int32_t *cpp = stack; u_int32_t *cpp = (u_int32_t *)*stackp;
u_int32_t dp; u_int32_t dp;
u_int32_t nullp = 0; u_int32_t nullp = 0;
char *sp; char *sp;
size_t len; size_t len;
int argc = arginfo->ps_nargvstr; int argc = arginfo->ps_nargvstr;
int envc = arginfo->ps_nenvstr; int envc = arginfo->ps_nenvstr;
int error;
if (copyout(&argc, cpp++, sizeof(argc))) if ((error = copyout(&argc, cpp++, sizeof(argc))) != 0)
return NULL; return error;
dp = (u_long) (cpp + argc + envc + 2 + pack->ep_esch->es_arglen); dp = (u_long) (cpp + argc + envc + 2 + pack->ep_esch->es_arglen);
sp = argp; sp = argp;
/* XXX don't copy them out, remap them! */ /* XXX don't copy them out, remap them! */
arginfo->ps_argvstr = (char **)(u_long)cpp; /* remember location of argv for later */ /* remember location of argv for later */
arginfo->ps_argvstr = (char **)(u_long)cpp;
for (; --argc >= 0; sp += len, dp += len) { for (; --argc >= 0; sp += len, dp += len) {
if (copyout(&dp, cpp++, sizeof(dp)) || if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
copyoutstr(sp, (char *)(u_long)dp, ARG_MAX, &len)) (error = copyoutstr(sp, (char *)(u_long)dp,
return NULL; ARG_MAX, &len)) != 0)
return error;
} }
if (copyout(&nullp, cpp++, sizeof(nullp))) if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return NULL; return error;
arginfo->ps_envstr = (char **)(u_long)cpp; /* remember location of envp for later */ /* remember location of envp for later */
arginfo->ps_envstr = (char **)(u_long)cpp;
for (; --envc >= 0; sp += len, dp += len) { for (; --envc >= 0; sp += len, dp += len) {
if (copyout(&dp, cpp++, sizeof(dp)) || if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
copyoutstr(sp, (char *)(u_long)dp, ARG_MAX, &len)) (error = copyoutstr(sp, (char *)(u_long)dp,
return NULL; ARG_MAX, &len)) != 0)
return error;
} }
if (copyout(&nullp, cpp++, sizeof(nullp))) if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return NULL; return error;
return cpp; *stackp = (char *)cpp;
return 0;
} }
#endif /* !_NETBSD32_EXEC_H_ */ #endif /* !_NETBSD32_EXEC_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_exec_elf32.c,v 1.4 2001/02/14 18:21:44 eeh Exp $ */ /* $NetBSD: netbsd32_exec_elf32.c,v 1.5 2001/07/29 21:28:46 christos Exp $ */
/* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */ /* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */
/* /*
@ -96,20 +96,19 @@ ELFNAME2(netbsd32,probe)(p, epp, eh, itp, pos)
* Copy arguments onto the stack in the normal way, but add some * Copy arguments onto the stack in the normal way, but add some
* extra information in case of dynamic binding. * extra information in case of dynamic binding.
*/ */
void * int
netbsd32_elf32_copyargs(pack, arginfo, stack, argp) netbsd32_elf32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
size_t len; size_t len;
AuxInfo ai[ELF_AUX_ENTRIES], *a; AuxInfo ai[ELF_AUX_ENTRIES], *a;
struct elf_args *ap; struct elf_args *ap;
stack = netbsd32_copyargs(pack, arginfo, stack, argp); if ((error = netbsd32_copyargs(pack, arginfo, stackp, argp)) != 0)
if (!stack) return error;
return NULL;
a = ai; a = ai;
@ -156,9 +155,9 @@ netbsd32_elf32_copyargs(pack, arginfo, stack, argp)
a++; a++;
len = (a - ai) * sizeof(AuxInfo); len = (a - ai) * sizeof(AuxInfo);
if (copyout(ai, stack, len)) if ((error = copyout(ai, *stackp, len)) != 0)
return NULL; return error;
stack = (caddr_t)stack + len; *stackp += len;
return stack; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: osf1_exec.h,v 1.3 2000/12/01 12:51:03 jdolecek Exp $ */ /* $NetBSD: osf1_exec.h,v 1.4 2001/07/29 21:28:46 christos Exp $ */
/* /*
* Copyright (c) 2000 The NetBSD foundation, Inc. * Copyright (c) 2000 The NetBSD foundation, Inc.
@ -39,7 +39,6 @@ extern const struct emul emul_osf1;
void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, u_long)); void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, u_long));
int osf1_exec_ecoff_probe __P((struct proc *, struct exec_package *)); int osf1_exec_ecoff_probe __P((struct proc *, struct exec_package *));
void *osf1_copyargs(struct exec_package *pack, int osf1_copyargs(struct exec_package *, struct ps_strings *, char **, void *);
struct ps_strings *arginfo, void *stack, void *argp);
#endif /* OSF1_EXEC_H */ #endif /* OSF1_EXEC_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: osf1_exec_ecoff.c,v 1.1 2000/12/08 21:39:31 jdolecek Exp $ */ /* $NetBSD: osf1_exec_ecoff.c,v 1.2 2001/07/29 21:28:46 christos Exp $ */
/* /*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@ -114,11 +114,11 @@ osf1_exec_ecoff_probe(struct proc *p, struct exec_package *epp)
* copy arguments onto the stack in the normal way, then copy out * copy arguments onto the stack in the normal way, then copy out
* any ELF-like AUX entries used by the dynamic loading scheme. * any ELF-like AUX entries used by the dynamic loading scheme.
*/ */
void * int
osf1_copyargs(pack, arginfo, stack, argp) osf1_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
struct proc *p = curproc; /* XXX !!! */ struct proc *p = curproc; /* XXX !!! */
@ -126,17 +126,18 @@ osf1_copyargs(pack, arginfo, stack, argp)
struct osf1_auxv ai[OSF1_MAX_AUX_ENTRIES], *a; struct osf1_auxv ai[OSF1_MAX_AUX_ENTRIES], *a;
char *prognameloc, *loadernameloc; char *prognameloc, *loadernameloc;
size_t len; size_t len;
int error;
stack = copyargs(pack, arginfo, stack, argp); if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
if (!stack) goto out;
goto bad;
a = ai; a = ai;
memset(ai, 0, sizeof ai); memset(ai, 0, sizeof ai);
prognameloc = (char *)stack + sizeof ai; prognameloc = *stackp + sizeof ai;
if (copyoutstr(emul_arg->exec_name, prognameloc, MAXPATHLEN + 1, NULL)) if ((error = copyoutstr(emul_arg->exec_name, prognameloc,
goto bad; MAXPATHLEN + 1, NULL)) != 0)
goto out;
a->a_type = OSF1_AT_EXEC_FILENAME; a->a_type = OSF1_AT_EXEC_FILENAME;
a->a_un.a_ptr = prognameloc; a->a_un.a_ptr = prognameloc;
a++; a++;
@ -147,9 +148,9 @@ osf1_copyargs(pack, arginfo, stack, argp)
if (emul_arg->flags & OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER) { if (emul_arg->flags & OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER) {
loadernameloc = prognameloc + MAXPATHLEN + 1; loadernameloc = prognameloc + MAXPATHLEN + 1;
if (copyoutstr(emul_arg->loader_name, loadernameloc, if ((error = copyoutstr(emul_arg->loader_name, loadernameloc,
MAXPATHLEN + 1, NULL)) MAXPATHLEN + 1, NULL)) != 0)
goto bad; goto out;
a->a_type = OSF1_AT_EXEC_LOADER_FILENAME; a->a_type = OSF1_AT_EXEC_LOADER_FILENAME;
a->a_un.a_ptr = loadernameloc; a->a_un.a_ptr = loadernameloc;
a++; a++;
@ -170,18 +171,14 @@ osf1_copyargs(pack, arginfo, stack, argp)
a++; a++;
len = (a - ai) * sizeof(struct osf1_auxv); len = (a - ai) * sizeof(struct osf1_auxv);
if (copyout(ai, stack, len)) if ((error = copyout(ai, *stackp, len)) != 0)
goto bad; goto out;
stack = (caddr_t)stack + len; *stackp += len;
out: out:
free(pack->ep_emul_arg, M_TEMP); free(pack->ep_emul_arg, M_TEMP);
pack->ep_emul_arg = NULL; pack->ep_emul_arg = NULL;
return stack; return error;
bad:
stack = NULL;
goto out;
} }
static int static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: pecoff_exec.c,v 1.10 2001/07/14 02:05:06 christos Exp $ */ /* $NetBSD: pecoff_exec.c,v 1.11 2001/07/29 21:28:46 christos Exp $ */
/* /*
* Copyright (c) 2000 Masaru OKI * Copyright (c) 2000 Masaru OKI
@ -117,32 +117,31 @@ const struct emul emul_pecoff = {
}; };
#endif #endif
void * int
pecoff_copyargs(pack, arginfo, stack, argp) pecoff_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
int len = sizeof(struct pecoff_args); int len = sizeof(struct pecoff_args);
struct pecoff_imghdr *ap; struct pecoff_imghdr *ap;
int error;
if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
stack = copyargs(pack, arginfo, stack, argp);
if (!stack) {
return NULL;
}
ap = (struct pecoff_imghdr *)pack->ep_emul_arg; ap = (struct pecoff_imghdr *)pack->ep_emul_arg;
if (copyout(ap, stack, len)) { if ((error = copyout(ap, *stackp, len)) != 0)
return NULL; return error;
}
#if 0 /* kern_exec.c? */ #if 0 /* kern_exec.c? */
free((char *)ap, M_TEMP); free((char *)ap, M_TEMP);
pack->ep_emul_arg = 0; pack->ep_emul_arg = 0;
#endif #endif
stack = (caddr_t)stack + len; *stackp += len;
return error;
return stack;
} }
#define PECOFF_SIGNATURE "PE\0\0" #define PECOFF_SIGNATURE "PE\0\0"

View File

@ -1,4 +1,4 @@
/* $NetBSD: pecoff_exec.h,v 1.2 2000/11/21 00:37:55 jdolecek Exp $ */ /* $NetBSD: pecoff_exec.h,v 1.3 2001/07/29 21:28:46 christos Exp $ */
/* /*
* Copyright (c) 2000 Masaru OKI * Copyright (c) 2000 Masaru OKI
@ -107,7 +107,7 @@ extern const struct emul emul_pecoff;
struct exec_package; struct exec_package;
int exec_pecoff_makecmds __P((struct proc *, struct exec_package *)); int exec_pecoff_makecmds __P((struct proc *, struct exec_package *));
void * pecoff_copyargs __P((struct exec_package *pack, int pecoff_copyargs __P((struct exec_package *, struct ps_strings *,
struct ps_strings *arginfo, void *stack, void *argp)); char **, void *));
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_exec.h,v 1.17 2001/02/21 23:53:01 eeh Exp $ */ /* $NetBSD: svr4_exec.h,v 1.18 2001/07/29 21:28:47 christos Exp $ */
/*- /*-
* Copyright (c) 1994 The NetBSD Foundation, Inc. * Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -47,10 +47,10 @@
# define SVR4_AUX_ARGSIZ64 howmany(sizeof(Aux64Info) * 8, sizeof(char *)) # define SVR4_AUX_ARGSIZ64 howmany(sizeof(Aux64Info) * 8, sizeof(char *))
#endif #endif
void *svr4_copyargs __P((struct exec_package *, struct ps_strings *, int svr4_copyargs __P((struct exec_package *, struct ps_strings *,
void *, void *)); char **, void *));
void *svr4_copyargs64 __P((struct exec_package *, struct ps_strings *, int svr4_copyargs64 __P((struct exec_package *, struct ps_strings *,
void *, void *)); char **, void *));
/* /*
* The following is horrible; there must be a better way. I need to * The following is horrible; there must be a better way. I need to

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_exec_elf32.c,v 1.1 2000/12/01 19:26:26 jdolecek Exp $ */ /* $NetBSD: svr4_exec_elf32.c,v 1.2 2001/07/29 21:28:47 christos Exp $ */
/*- /*-
* Copyright (c) 1994 The NetBSD Foundation, Inc. * Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -58,17 +58,20 @@
#include <compat/svr4/svr4_exec.h> #include <compat/svr4/svr4_exec.h>
#include <compat/svr4/svr4_errno.h> #include <compat/svr4/svr4_errno.h>
void * int
svr4_copyargs(pack, arginfo, stack, argp) svr4_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
AuxInfo *a; AuxInfo *a;
int error;
if (!(a = (AuxInfo *) elf32_copyargs(pack, arginfo, stack, argp))) if ((error = elf32_copyargs(pack, arginfo, stackp, argp)) != 0)
return NULL; return error;
a = (AuxInfo *)*stackp;
#ifdef SVR4_COMPAT_SOLARIS2 #ifdef SVR4_COMPAT_SOLARIS2
if (pack->ep_emul_arg) { if (pack->ep_emul_arg) {
a->au_type = AT_SUN_UID; a->au_type = AT_SUN_UID;
@ -88,7 +91,8 @@ svr4_copyargs(pack, arginfo, stack, argp)
a++; a++;
} }
#endif #endif
return a; *stackp = (char *)a;
return 0;
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_exec_elf64.c,v 1.1 2001/02/21 23:53:02 eeh Exp $ */ /* $NetBSD: svr4_exec_elf64.c,v 1.2 2001/07/29 21:28:47 christos Exp $ */
/*- /*-
* Copyright (c) 1994 The NetBSD Foundation, Inc. * Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -58,17 +58,20 @@
#include <compat/svr4/svr4_exec.h> #include <compat/svr4/svr4_exec.h>
#include <compat/svr4/svr4_errno.h> #include <compat/svr4/svr4_errno.h>
void * int
svr4_copyargs64(pack, arginfo, stack, argp) svr4_copyargs64(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
AuxInfo *a; AuxInfo *a;
int error;
if (!(a = (AuxInfo *) elf64_copyargs(pack, arginfo, stack, argp))) if ((error = elf64_copyargs(pack, arginfo, stackp, argp)) != 0)
return NULL; return error;
a = (AuxInfo *)*stackp;
#ifdef SVR4_COMPAT_SOLARIS2 #ifdef SVR4_COMPAT_SOLARIS2
if (pack->ep_emul_arg) { if (pack->ep_emul_arg) {
a->au_type = AT_SUN_UID; a->au_type = AT_SUN_UID;
@ -88,7 +91,8 @@ svr4_copyargs64(pack, arginfo, stack, argp)
a++; a++;
} }
#endif #endif
return a; *stackp = (char *)a;
return 0;
} }
int int

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_32_exec.h,v 1.2 2001/02/11 01:10:24 eeh Exp $ */ /* $NetBSD: svr4_32_exec.h,v 1.3 2001/07/29 21:28:47 christos Exp $ */
/*- /*-
* Copyright (c) 1994 The NetBSD Foundation, Inc. * Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -47,8 +47,8 @@
# define SVR4_32_AUX_ARGSIZ howmany(sizeof(Aux32Info) * 8, sizeof(netbsd32_charp)) # define SVR4_32_AUX_ARGSIZ howmany(sizeof(Aux32Info) * 8, sizeof(netbsd32_charp))
#endif #endif
void *svr4_32_copyargs __P((struct exec_package *, struct ps_strings *, int svr4_32_copyargs __P((struct exec_package *, struct ps_strings *,
void *, void *)); char **, void *));
/* /*
* The following is horrible; there must be a better way. I need to * The following is horrible; there must be a better way. I need to

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_32_exec_elf32.c,v 1.2 2001/02/11 01:10:24 eeh Exp $ */ /* $NetBSD: svr4_32_exec_elf32.c,v 1.3 2001/07/29 21:28:47 christos Exp $ */
/*- /*-
* Copyright (c) 1994 The NetBSD Foundation, Inc. * Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -72,21 +72,21 @@ int sun_flags = EF_SPARC_SUN_US1|EF_SPARC_32PLUS;
int sun_hwcap = (AV_SPARC_HWMUL_32x32|AV_SPARC_HWDIV_32x32|AV_SPARC_HWFSMULD); int sun_hwcap = (AV_SPARC_HWMUL_32x32|AV_SPARC_HWDIV_32x32|AV_SPARC_HWFSMULD);
#if 0 #if 0
void * int
svr4_32_copyargs(pack, arginfo, stack, argp) svr4_32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
size_t len; size_t len;
AuxInfo ai[SVR4_32_AUX_ARGSIZ], *a, *platform=NULL, *exec=NULL; AuxInfo ai[SVR4_32_AUX_ARGSIZ], *a, *platform=NULL, *exec=NULL;
struct elf_args *ap; struct elf_args *ap;
extern char platform_type[32]; extern char platform_type[32];
int error;
stack = netbsd32_copyargs(pack, arginfo, stack, argp); if ((error = netbsd32_copyargs(pack, arginfo, stackp, argp)) != 0)
if (!stack) return error;
return NULL;
a = ai; a = ai;
@ -174,7 +174,7 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
const char *path = NULL; const char *path = NULL;
/* Copy out the platform name. */ /* Copy out the platform name. */
platform->a_v = (u_long)stack + len; platform->a_v = (u_long)(*stackp) + len;
/* XXXX extremely inefficient.... */ /* XXXX extremely inefficient.... */
strcpy(ptr, platform_type); strcpy(ptr, platform_type);
ptr += strlen(platform_type) + 1; ptr += strlen(platform_type) + 1;
@ -184,7 +184,7 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
path = pack->ep_ndp->ni_cnd.cn_pnbuf; path = pack->ep_ndp->ni_cnd.cn_pnbuf;
/* Copy out the file we're executing. */ /* Copy out the file we're executing. */
exec->a_v = (u_long)stack + len; exec->a_v = (u_long)(*stackp) + len;
strcpy(ptr, path); strcpy(ptr, path);
len += strlen(ptr)+1; len += strlen(ptr)+1;
} }
@ -192,27 +192,27 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
/* Round to 32-bits */ /* Round to 32-bits */
len = (len+7)&~0x7L; len = (len+7)&~0x7L;
} }
if (copyout(ai, stack, len)) if ((error = copyout(ai, *stackp, len)) != 0)
return NULL; return error;
stack = (caddr_t)stack + len; *stackp += len;
return stack; return error;
} }
#else #else
void * int
svr4_32_copyargs(pack, arginfo, stack, argp) svr4_32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack; struct exec_package *pack;
struct ps_strings *arginfo; struct ps_strings *arginfo;
void *stack; char **stackp;
void *argp; void *argp;
{ {
size_t len; size_t len;
AuxInfo ai[SVR4_32_AUX_ARGSIZ], *a; AuxInfo ai[SVR4_32_AUX_ARGSIZ], *a;
struct elf_args *ap; struct elf_args *ap;
int error;
stack = netbsd32_copyargs(pack, arginfo, stack, argp); if ((error = netbsd32_copyargs(pack, arginfo, stackp, argp)) != 0)
if (!stack) return error;
return NULL;
a = ai; a = ai;
@ -261,11 +261,11 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
a++; a++;
len = (a - ai) * sizeof(AuxInfo); len = (a - ai) * sizeof(AuxInfo);
if (copyout(ai, stack, len)) if (copyout(ai, *stackp, len))
return NULL; return error;
stack = (caddr_t)stack + len; *stackp += len;
return stack; return 0;
} }
#endif #endif