Use sigcode fields in package structure. This seems to be the cleanest

way to deal with seperate trampoline code for emulation of other OSs,
it avoids having to clutter up kern_exec.c any further.
This commit is contained in:
fvdl 1995-04-07 22:33:23 +00:00
parent fb00b736fd
commit 366ba9b889

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_exec.c,v 1.64 1995/03/09 12:05:39 mycroft Exp $ */ /* $NetBSD: kern_exec.c,v 1.65 1995/04/07 22:33:23 fvdl Exp $ */
/*- /*-
* Copyright (C) 1993, 1994 Christopher G. Demetriou * Copyright (C) 1993, 1994 Christopher G. Demetriou
@ -61,10 +61,6 @@
#ifdef COPY_SIGCODE #ifdef COPY_SIGCODE
extern char sigcode[], esigcode[]; extern char sigcode[], esigcode[];
#define szsigcode (esigcode - sigcode)
#else
#define szsigcode 0
#endif #endif
/* /*
@ -223,6 +219,7 @@ execve(p, uap, retval)
struct ps_strings arginfo; struct ps_strings arginfo;
struct vmspace *vm = p->p_vmspace; struct vmspace *vm = p->p_vmspace;
char **tmpfap; char **tmpfap;
int szsigcode;
/* /*
* figure out the maximum size of an exec header, if necessary. * figure out the maximum size of an exec header, if necessary.
@ -255,6 +252,10 @@ execve(p, uap, retval)
pack.ep_vap = &attr; pack.ep_vap = &attr;
pack.ep_emul = EMUL_NETBSD; pack.ep_emul = EMUL_NETBSD;
pack.ep_flags = 0; pack.ep_flags = 0;
#ifdef COPY_SIGCODE
pack.ep_sigcode = sigcode;
pack.ep_esigcode = esigcode;
#endif
/* see if we can run it. */ /* see if we can run it. */
if (error = check_exec(p, &pack)) if (error = check_exec(p, &pack))
@ -335,12 +336,18 @@ execve(p, uap, retval)
dp = (char *) ALIGN(dp); dp = (char *) ALIGN(dp);
#ifdef COPY_SIGCODE
szsigcode = pack.ep_esigcode - pack.ep_sigcode;
#else
szsigcode = 0;
#endif
/* Now check if args & environ fit into new stack */ /* Now check if args & environ fit into new stack */
len = ((argc + envc + 2 + pack.ep_setup_arglen) * sizeof(char *) + len = ((argc + envc + 2 + pack.ep_setup_arglen) * sizeof(char *) +
sizeof(long) + dp + STACKGAPLEN + szsigcode + sizeof(long) + dp + STACKGAPLEN + szsigcode +
sizeof(struct ps_strings)) - argp; sizeof(struct ps_strings)) - argp;
#ifdef COMPAT_LINUX #ifdef COMPAT_LINUX
/* XXXX need this for envp and argv on stack */ /* XXXX need this for envp and argv on stack, and sigcode */
if (pack.ep_emul == EMUL_LINUX) if (pack.ep_emul == EMUL_LINUX)
len += 2 * sizeof (char *); len += 2 * sizeof (char *);
#endif #endif
@ -456,7 +463,7 @@ execve(p, uap, retval)
#ifdef COPY_SIGCODE #ifdef COPY_SIGCODE
/* copy out the process's signal trapoline code */ /* copy out the process's signal trapoline code */
if (copyout((char *) sigcode, ((char *) PS_STRINGS) - szsigcode, if (copyout((char *) pack.ep_sigcode, ((char *) PS_STRINGS) - szsigcode,
szsigcode)) { szsigcode)) {
goto exec_abort; goto exec_abort;
} }