make netbsd32_copyargs() an inline
This commit is contained in:
parent
0b76f4efdf
commit
df127e0001
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: netbsd32_exec.h,v 1.6 2000/11/27 17:25:24 jdolecek Exp $ */
|
||||
/* $NetBSD: netbsd32_exec.h,v 1.7 2000/12/01 22:05:18 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 Matthew R. Green
|
||||
@ -54,8 +54,6 @@ extern const struct emul emul_netbsd32;
|
||||
|
||||
#ifdef EXEC_AOUT
|
||||
int exec_netbsd32_makecmds __P((struct proc *, struct exec_package *));
|
||||
void *netbsd32_copyargs __P((struct exec_package *, struct ps_strings *,
|
||||
void *, void *));
|
||||
#endif
|
||||
#ifdef EXEC_ELF32
|
||||
int netbsd32_elf32_probe __P((struct proc *, struct exec_package *, void *,
|
||||
@ -64,4 +62,55 @@ void *netbsd32_elf32_copyargs __P((struct exec_package *, struct ps_strings *,
|
||||
void *, void *));
|
||||
#endif /* EXEC_ELF32 */
|
||||
|
||||
static __inline void *netbsd32_copyargs __P((struct exec_package *,
|
||||
struct ps_strings *, void *, void *));
|
||||
|
||||
/*
|
||||
* We need to copy out all pointers as 32-bit values.
|
||||
*/
|
||||
static __inline void *
|
||||
netbsd32_copyargs(pack, arginfo, stack, argp)
|
||||
struct exec_package *pack;
|
||||
struct ps_strings *arginfo;
|
||||
void *stack;
|
||||
void *argp;
|
||||
{
|
||||
u_int32_t *cpp = stack;
|
||||
u_int32_t dp;
|
||||
u_int32_t nullp = 0;
|
||||
char *sp;
|
||||
size_t len;
|
||||
int argc = arginfo->ps_nargvstr;
|
||||
int envc = arginfo->ps_nenvstr;
|
||||
|
||||
if (copyout(&argc, cpp++, sizeof(argc)))
|
||||
return NULL;
|
||||
|
||||
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 */
|
||||
|
||||
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 (copyout(&nullp, cpp++, sizeof(nullp)))
|
||||
return NULL;
|
||||
|
||||
arginfo->ps_envstr = (char **)(u_long)cpp; /* remember location of envp for later */
|
||||
|
||||
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 (copyout(&nullp, cpp++, sizeof(nullp)))
|
||||
return NULL;
|
||||
|
||||
return cpp;
|
||||
}
|
||||
|
||||
#endif /* !_NETBSD32_EXEC_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user