de-static netbsd32_exec_aout_prep_[zno]magic().

de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).
This commit is contained in:
mrg 2001-02-02 07:08:17 +00:00
parent 5592504080
commit e4c34bc9e5
5 changed files with 34 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32.h,v 1.15 2000/12/03 13:15:38 fvdl Exp $ */
/* $NetBSD: netbsd32.h,v 1.16 2001/02/02 07:08:17 mrg Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@ -40,6 +40,8 @@
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscallargs.h>
#include <sys/ipc.h>
#include <sys/shm.h>
@ -526,5 +528,8 @@ typedef struct firm_event32 {
* random other stuff
*/
#include <compat/common/compat_util.h>
void netbsd32_from_stat43 __P((struct stat43 *, struct netbsd32_stat43 *));
int netbsd32_execve2(struct proc *, struct sys_execve_args *, register_t *);
#endif /* _COMPAT_NETBSD32_NETBSD32_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_compat_43.c,v 1.13 2000/12/03 14:47:27 fvdl Exp $ */
/* $NetBSD: netbsd32_compat_43.c,v 1.14 2001/02/02 07:08:17 mrg Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@ -49,13 +49,12 @@
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
static void netbsd32_from_stat43 __P((struct stat43 *, struct netbsd32_stat43 *));
int compat_43_netbsd32_sethostid __P((struct proc *, void *, register_t *));
int compat_43_netbsd32_killpg __P((struct proc *, void *, register_t *retval));
int compat_43_netbsd32_sigblock __P((struct proc *, void *, register_t *retval));
int compat_43_netbsd32_sigblock __P((struct proc *, void *, register_t *retval));
static void
void
netbsd32_from_stat43(sp43, sp32)
struct stat43 *sp43;
struct netbsd32_stat43 *sp32;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_exec.h,v 1.7 2000/12/01 22:05:18 jdolecek Exp $ */
/* $NetBSD: netbsd32_exec.h,v 1.8 2001/02/02 07:08:17 mrg Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@ -53,6 +53,9 @@ struct netbsd32_exec {
extern const struct emul emul_netbsd32;
#ifdef EXEC_AOUT
int netbsd32_exec_aout_prep_zmagic __P((struct proc *, struct exec_package *));
int netbsd32_exec_aout_prep_nmagic __P((struct proc *, struct exec_package *));
int netbsd32_exec_aout_prep_omagic __P((struct proc *, struct exec_package *));
int exec_netbsd32_makecmds __P((struct proc *, struct exec_package *));
#endif
#ifdef EXEC_ELF32

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_exec_aout.c,v 1.2 2000/12/18 14:50:04 mrg Exp $ */
/* $NetBSD: netbsd32_exec_aout.c,v 1.3 2001/02/02 07:08:18 mrg Exp $ */
/* from: NetBSD: exec_aout.c,v 1.15 1996/09/26 23:34:46 cgd Exp */
/*
@ -54,12 +54,6 @@
int netbsd32_copyinargs __P((struct exec_package *, struct ps_strings *,
void *, size_t, const void *, const void *));
static int netbsd32_exec_aout_prep_zmagic __P((struct proc *,
struct exec_package *));
static int netbsd32_exec_aout_prep_nmagic __P((struct proc *,
struct exec_package *));
static int netbsd32_exec_aout_prep_omagic __P((struct proc *,
struct exec_package *));
int netbsd32_exec_aout_setup_stack __P((struct proc *p,
struct exec_package *epp));

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_netbsd.c,v 1.48 2001/01/22 20:08:05 jdolecek Exp $ */
/* $NetBSD: netbsd32_netbsd.c,v 1.49 2001/02/02 07:08:18 mrg Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@ -1800,6 +1800,22 @@ netbsd32_execve(p, v, retval)
} */ *uap = v;
struct sys_execve_args ua;
caddr_t sg;
NETBSD32TOP_UAP(path, const char);
NETBSD32TOP_UAP(argp, char *);
NETBSD32TOP_UAP(envp, char *);
sg = stackgap_init(p->p_emul);
CHECK_ALT_EXIST(p, &sg, SCARG(&ua, path));
return netbsd32_execve2(p, &ua, retval);
}
int
netbsd32_execve2(p, uap, retval)
struct proc *p;
struct sys_execve_args *uap;
register_t *retval;
{
/* Function args */
int error, i;
struct exec_package pack;
@ -1819,20 +1835,14 @@ netbsd32_execve(p, v, retval)
int szsigcode;
struct exec_vmcmd *base_vcp = NULL;
NETBSD32TOP_UAP(path, const char);
NETBSD32TOP_UAP(argp, char *);
NETBSD32TOP_UAP(envp, char *);
sg = stackgap_init(p->p_emul);
CHECK_ALT_EXIST(p, &sg, SCARG(&ua, path));
/* init the namei data to point the file user's program name */
/* XXX cgd 960926: why do this here? most will be clobbered. */
NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(&ua, path), p);
NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
/*
* initialize the fields of the exec package.
*/
pack.ep_name = SCARG(&ua, path);
pack.ep_name = SCARG(uap, path);
pack.ep_hdr = malloc(exec_maxhdrsz, M_EXEC, M_WAITOK);
pack.ep_hdrlen = exec_maxhdrsz;
pack.ep_hdrvalid = 0;
@ -1879,7 +1889,7 @@ netbsd32_execve(p, v, retval)
}
/* Now get argv & environment */
if (!(cpp = (netbsd32_charp *)SCARG(&ua, argp))) {
if (!(cpp = (netbsd32_charp *)SCARG(uap, argp))) {
error = EINVAL;
goto bad;
}
@ -1906,7 +1916,7 @@ netbsd32_execve(p, v, retval)
envc = 0;
/* environment need not be there */
if ((cpp = (netbsd32_charp *)SCARG(&ua, envp)) != NULL ) {
if ((cpp = (netbsd32_charp *)SCARG(uap, envp)) != NULL ) {
while (1) {
len = argp + ARG_MAX - dp;
if ((error = copyin(cpp, &sp, sizeof(sp))) != 0)