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.
@ -85,10 +85,12 @@ typedef struct {
#ifdef _KERNEL
__BEGIN_DECLS
#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
#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
__END_DECLS
#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
@ -19,17 +19,17 @@
* XXX port. If so, move it to common/linux_exec_elf32.c
* XXX included based on some define.
*/
void *
int
ELFNAME2(linux,copyargs)(struct exec_package *pack, struct ps_strings *arginfo,
void *stack, void *argp)
char **stackp, void *argp)
{
size_t len;
LinuxAuxInfo ai[LINUX_ELF_AUX_ENTRIES], *a;
struct elf_args *ap;
int error;
stack = copyargs(pack, arginfo, stack, argp);
if (!stack)
return(NULL);
if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
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++;
len = (a - ai) * sizeof(LinuxAuxInfo);
if (copyout(ai, stack, len))
return NULL;
stack = (caddr_t)stack + len;
if ((error = copyout(ai, *stackp, len)) != 0)
return error;
*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.
@ -116,8 +116,8 @@ typedef struct {
#ifdef _KERNEL
__BEGIN_DECLS
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 *));
__END_DECLS
#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.
@ -72,11 +72,11 @@ extern int linux_sp_wrap_entry;
/*
* Alpha and PowerPC specific linux copyargs function.
*/
void *
ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
int
ELFNAME2(linux,copyargs)(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
size_t len;
@ -88,6 +88,7 @@ ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
char linux_sp_wrap_code[LINUX_SP_WRAP];
unsigned long* cga;
#endif
int error;
#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
* 16 bytes aligned,
*/
(unsigned long)stack = ((unsigned long)stack - 1) & ~LINUX_SHIFT;
*stackp = (char *)((unsigned long)*stackp - 1) & ~LINUX_SHIFT;
#endif
stack = copyargs(pack, arginfo, stack, argp);
if (!stack)
return(NULL);
if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
#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
* the PowerPC.
*/
stack = (void *)(((unsigned long) stack + LINUX_SHIFT) & ~LINUX_SHIFT);
*stackp = (char *)(((unsigned long)(*stackp) + LINUX_SHIFT)
& ~LINUX_SHIFT);
#endif
memset(ai, 0, sizeof(LinuxAuxInfo) * LINUX_ELF_AUX_ENTRIES);
@ -205,20 +206,21 @@ ELFNAME2(linux,copyargs)(pack, arginfo, stack, argp)
#ifdef LINUX_SP_WRAP
if (prog_entry != NULL)
prog_entry->a_v = (unsigned long)stack + len;
prog_entry->a_v = (unsigned long)(*stackp) + len;
#endif
if (copyout(ai, stack, len))
return NULL;
stack = (caddr_t)stack + len;
if ((error = copyout(ai, *stackp, len)) != 0)
return error;
*stackp += len;
#ifdef LINUX_SP_WRAP
if (prog_entry != NULL) {
if (copyout(linux_sp_wrap_code, stack, LINUX_SP_WRAP))
return NULL;
stack = (caddr_t)stack + LINUX_SP_WRAP;
if ((error = copyout(linux_sp_wrap_code, *stackp,
LINUX_SP_WRAP)) != 0)
return error;
*stackp += LINUX_SP_WRAP;
}
#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.
@ -93,8 +93,8 @@ extern const struct emul emul_linux;
void linux_setregs __P((struct proc *, struct exec_package *, u_long));
int exec_linux_aout_makecmds __P((struct proc *, struct exec_package *));
void *linux_aout_copyargs __P((struct exec_package *,
struct ps_strings *, void *, void *));
int linux_aout_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
void linux_trapsignal __P((struct proc *, int, u_long));
#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.
@ -66,40 +66,41 @@
#include <compat/linux/linux_syscallargs.h>
#include <compat/linux/linux_syscall.h>
void *linux_aout_copyargs __P((struct exec_package *,
struct ps_strings *, void *, void *));
int linux_aout_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
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 *,
struct exec_package *));
struct exec_package *));
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 *,
struct exec_package *));
struct exec_package *));
void *
linux_aout_copyargs(pack, arginfo, stack, argp)
int
linux_aout_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
char **cpp = stack;
char **stk = stack;
char **cpp = (char **)*stackp;
char **stk = (char **)*stackp;
char *dp, *sp;
size_t len;
void *nullp = NULL;
int argc = arginfo->ps_nargvstr;
int envc = arginfo->ps_nenvstr;
int error;
if (copyout(&argc, cpp++, sizeof(argc)))
return NULL;
if ((error = copyout(&argc, cpp++, sizeof(argc))) != 0)
return error;
/* leave room for envp and argv */
cpp += 2;
if (copyout(&cpp, &stk[1], sizeof (cpp)))
return NULL;
if ((error = copyout(&cpp, &stk[1], sizeof (cpp))) != 0)
return error;
dp = (char *) (cpp + argc + envc + 2);
sp = argp;
@ -108,27 +109,28 @@ linux_aout_copyargs(pack, arginfo, stack, argp)
arginfo->ps_argvstr = cpp; /* remember location of argv for later */
for (; --argc >= 0; sp += len, dp += len)
if (copyout(&dp, cpp++, sizeof(dp)) ||
copyoutstr(sp, dp, ARG_MAX, &len))
return NULL;
if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
(error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
return error;
if (copyout(&nullp, cpp++, sizeof(nullp)))
return NULL;
if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return error;
if (copyout(&cpp, &stk[2], sizeof (cpp)))
return NULL;
if ((error = copyout(&cpp, &stk[2], sizeof (cpp))) != 0)
return error;
arginfo->ps_envstr = cpp; /* remember location of envp for later */
for (; --envc >= 0; sp += len, dp += len)
if (copyout(&dp, cpp++, sizeof(dp)) ||
copyoutstr(sp, dp, ARG_MAX, &len))
return NULL;
if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
(error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
return error;
if (copyout(&nullp, cpp++, sizeof(nullp)))
return NULL;
if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return error;
return cpp;
*stackp = (char *)cpp;
return 0;
}
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
@ -61,59 +61,65 @@ int exec_netbsd32_makecmds __P((struct proc *, struct exec_package *));
#ifdef EXEC_ELF32
int netbsd32_elf32_probe __P((struct proc *, struct exec_package *, void *,
char *, vaddr_t *));
void *netbsd32_elf32_copyargs __P((struct exec_package *, struct ps_strings *,
void *, void *));
int netbsd32_elf32_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
#endif /* EXEC_ELF32 */
static __inline void *netbsd32_copyargs __P((struct exec_package *,
struct ps_strings *, void *, void *));
static __inline int netbsd32_copyargs __P((struct exec_package *,
struct ps_strings *, char **, void *));
/*
* We need to copy out all pointers as 32-bit values.
*/
static __inline void *
netbsd32_copyargs(pack, arginfo, stack, argp)
static __inline int
netbsd32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
u_int32_t *cpp = stack;
u_int32_t *cpp = (u_int32_t *)*stackp;
u_int32_t dp;
u_int32_t nullp = 0;
char *sp;
size_t len;
int argc = arginfo->ps_nargvstr;
int envc = arginfo->ps_nenvstr;
int error;
if (copyout(&argc, cpp++, sizeof(argc)))
return NULL;
if ((error = copyout(&argc, cpp++, sizeof(argc))) != 0)
return error;
dp = (u_long) (cpp + argc + envc + 2 + pack->ep_esch->es_arglen);
sp = argp;
/* 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) {
if (copyout(&dp, cpp++, sizeof(dp)) ||
copyoutstr(sp, (char *)(u_long)dp, ARG_MAX, &len))
return NULL;
if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
(error = copyoutstr(sp, (char *)(u_long)dp,
ARG_MAX, &len)) != 0)
return error;
}
if (copyout(&nullp, cpp++, sizeof(nullp)))
return NULL;
if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
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) {
if (copyout(&dp, cpp++, sizeof(dp)) ||
copyoutstr(sp, (char *)(u_long)dp, ARG_MAX, &len))
return NULL;
if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
(error = copyoutstr(sp, (char *)(u_long)dp,
ARG_MAX, &len)) != 0)
return error;
}
if (copyout(&nullp, cpp++, sizeof(nullp)))
return NULL;
if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return error;
return cpp;
*stackp = (char *)cpp;
return 0;
}
#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 */
/*
@ -96,20 +96,19 @@ ELFNAME2(netbsd32,probe)(p, epp, eh, itp, pos)
* Copy arguments onto the stack in the normal way, but add some
* extra information in case of dynamic binding.
*/
void *
netbsd32_elf32_copyargs(pack, arginfo, stack, argp)
int
netbsd32_elf32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
size_t len;
AuxInfo ai[ELF_AUX_ENTRIES], *a;
struct elf_args *ap;
stack = netbsd32_copyargs(pack, arginfo, stack, argp);
if (!stack)
return NULL;
if ((error = netbsd32_copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
a = ai;
@ -156,9 +155,9 @@ netbsd32_elf32_copyargs(pack, arginfo, stack, argp)
a++;
len = (a - ai) * sizeof(AuxInfo);
if (copyout(ai, stack, len))
return NULL;
stack = (caddr_t)stack + len;
if ((error = copyout(ai, *stackp, len)) != 0)
return error;
*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.
@ -39,7 +39,6 @@ extern const struct emul emul_osf1;
void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *, u_long));
int osf1_exec_ecoff_probe __P((struct proc *, struct exec_package *));
void *osf1_copyargs(struct exec_package *pack,
struct ps_strings *arginfo, void *stack, void *argp);
int osf1_copyargs(struct exec_package *, struct ps_strings *, char **, void *);
#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.
@ -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
* any ELF-like AUX entries used by the dynamic loading scheme.
*/
void *
osf1_copyargs(pack, arginfo, stack, argp)
int
osf1_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
struct proc *p = curproc; /* XXX !!! */
@ -126,17 +126,18 @@ osf1_copyargs(pack, arginfo, stack, argp)
struct osf1_auxv ai[OSF1_MAX_AUX_ENTRIES], *a;
char *prognameloc, *loadernameloc;
size_t len;
int error;
stack = copyargs(pack, arginfo, stack, argp);
if (!stack)
goto bad;
if ((error = copyargs(pack, arginfo, stackp, argp)) != 0)
goto out;
a = ai;
memset(ai, 0, sizeof ai);
prognameloc = (char *)stack + sizeof ai;
if (copyoutstr(emul_arg->exec_name, prognameloc, MAXPATHLEN + 1, NULL))
goto bad;
prognameloc = *stackp + sizeof ai;
if ((error = copyoutstr(emul_arg->exec_name, prognameloc,
MAXPATHLEN + 1, NULL)) != 0)
goto out;
a->a_type = OSF1_AT_EXEC_FILENAME;
a->a_un.a_ptr = prognameloc;
a++;
@ -147,9 +148,9 @@ osf1_copyargs(pack, arginfo, stack, argp)
if (emul_arg->flags & OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER) {
loadernameloc = prognameloc + MAXPATHLEN + 1;
if (copyoutstr(emul_arg->loader_name, loadernameloc,
MAXPATHLEN + 1, NULL))
goto bad;
if ((error = copyoutstr(emul_arg->loader_name, loadernameloc,
MAXPATHLEN + 1, NULL)) != 0)
goto out;
a->a_type = OSF1_AT_EXEC_LOADER_FILENAME;
a->a_un.a_ptr = loadernameloc;
a++;
@ -170,18 +171,14 @@ osf1_copyargs(pack, arginfo, stack, argp)
a++;
len = (a - ai) * sizeof(struct osf1_auxv);
if (copyout(ai, stack, len))
goto bad;
stack = (caddr_t)stack + len;
if ((error = copyout(ai, *stackp, len)) != 0)
goto out;
*stackp += len;
out:
free(pack->ep_emul_arg, M_TEMP);
pack->ep_emul_arg = NULL;
return stack;
bad:
stack = NULL;
goto out;
return error;
}
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
@ -117,32 +117,31 @@ const struct emul emul_pecoff = {
};
#endif
void *
pecoff_copyargs(pack, arginfo, stack, argp)
int
pecoff_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
int len = sizeof(struct pecoff_args);
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;
if (copyout(ap, stack, len)) {
return NULL;
}
if ((error = copyout(ap, *stackp, len)) != 0)
return error;
#if 0 /* kern_exec.c? */
free((char *)ap, M_TEMP);
pack->ep_emul_arg = 0;
#endif
stack = (caddr_t)stack + len;
return stack;
*stackp += len;
return error;
}
#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
@ -107,7 +107,7 @@ extern const struct emul emul_pecoff;
struct exec_package;
int exec_pecoff_makecmds __P((struct proc *, struct exec_package *));
void * pecoff_copyargs __P((struct exec_package *pack,
struct ps_strings *arginfo, void *stack, void *argp));
int pecoff_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
#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.
@ -47,10 +47,10 @@
# define SVR4_AUX_ARGSIZ64 howmany(sizeof(Aux64Info) * 8, sizeof(char *))
#endif
void *svr4_copyargs __P((struct exec_package *, struct ps_strings *,
void *, void *));
void *svr4_copyargs64 __P((struct exec_package *, struct ps_strings *,
void *, void *));
int svr4_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
int svr4_copyargs64 __P((struct exec_package *, struct ps_strings *,
char **, void *));
/*
* 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.
@ -58,17 +58,20 @@
#include <compat/svr4/svr4_exec.h>
#include <compat/svr4/svr4_errno.h>
void *
svr4_copyargs(pack, arginfo, stack, argp)
int
svr4_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
AuxInfo *a;
int error;
if (!(a = (AuxInfo *) elf32_copyargs(pack, arginfo, stack, argp)))
return NULL;
if ((error = elf32_copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
a = (AuxInfo *)*stackp;
#ifdef SVR4_COMPAT_SOLARIS2
if (pack->ep_emul_arg) {
a->au_type = AT_SUN_UID;
@ -88,7 +91,8 @@ svr4_copyargs(pack, arginfo, stack, argp)
a++;
}
#endif
return a;
*stackp = (char *)a;
return 0;
}
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.
@ -58,17 +58,20 @@
#include <compat/svr4/svr4_exec.h>
#include <compat/svr4/svr4_errno.h>
void *
svr4_copyargs64(pack, arginfo, stack, argp)
int
svr4_copyargs64(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
AuxInfo *a;
int error;
if (!(a = (AuxInfo *) elf64_copyargs(pack, arginfo, stack, argp)))
return NULL;
if ((error = elf64_copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
a = (AuxInfo *)*stackp;
#ifdef SVR4_COMPAT_SOLARIS2
if (pack->ep_emul_arg) {
a->au_type = AT_SUN_UID;
@ -88,7 +91,8 @@ svr4_copyargs64(pack, arginfo, stack, argp)
a++;
}
#endif
return a;
*stackp = (char *)a;
return 0;
}
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.
@ -47,8 +47,8 @@
# define SVR4_32_AUX_ARGSIZ howmany(sizeof(Aux32Info) * 8, sizeof(netbsd32_charp))
#endif
void *svr4_32_copyargs __P((struct exec_package *, struct ps_strings *,
void *, void *));
int svr4_32_copyargs __P((struct exec_package *, struct ps_strings *,
char **, void *));
/*
* 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.
@ -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);
#if 0
void *
svr4_32_copyargs(pack, arginfo, stack, argp)
int
svr4_32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
size_t len;
AuxInfo ai[SVR4_32_AUX_ARGSIZ], *a, *platform=NULL, *exec=NULL;
struct elf_args *ap;
extern char platform_type[32];
int error;
stack = netbsd32_copyargs(pack, arginfo, stack, argp);
if (!stack)
return NULL;
if ((error = netbsd32_copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
a = ai;
@ -174,7 +174,7 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
const char *path = NULL;
/* Copy out the platform name. */
platform->a_v = (u_long)stack + len;
platform->a_v = (u_long)(*stackp) + len;
/* XXXX extremely inefficient.... */
strcpy(ptr, platform_type);
ptr += strlen(platform_type) + 1;
@ -184,7 +184,7 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
path = pack->ep_ndp->ni_cnd.cn_pnbuf;
/* Copy out the file we're executing. */
exec->a_v = (u_long)stack + len;
exec->a_v = (u_long)(*stackp) + len;
strcpy(ptr, path);
len += strlen(ptr)+1;
}
@ -192,27 +192,27 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
/* Round to 32-bits */
len = (len+7)&~0x7L;
}
if (copyout(ai, stack, len))
return NULL;
stack = (caddr_t)stack + len;
if ((error = copyout(ai, *stackp, len)) != 0)
return error;
*stackp += len;
return stack;
return error;
}
#else
void *
svr4_32_copyargs(pack, arginfo, stack, argp)
int
svr4_32_copyargs(pack, arginfo, stackp, argp)
struct exec_package *pack;
struct ps_strings *arginfo;
void *stack;
char **stackp;
void *argp;
{
size_t len;
AuxInfo ai[SVR4_32_AUX_ARGSIZ], *a;
struct elf_args *ap;
int error;
stack = netbsd32_copyargs(pack, arginfo, stack, argp);
if (!stack)
return NULL;
if ((error = netbsd32_copyargs(pack, arginfo, stackp, argp)) != 0)
return error;
a = ai;
@ -261,11 +261,11 @@ svr4_32_copyargs(pack, arginfo, stack, argp)
a++;
len = (a - ai) * sizeof(AuxInfo);
if (copyout(ai, stack, len))
return NULL;
stack = (caddr_t)stack + len;
if (copyout(ai, *stackp, len))
return error;
*stackp += len;
return stack;
return 0;
}
#endif