Add sunos32_setregs(), thus making sunos32 compile again.

This commit is contained in:
thorpej 2001-09-20 20:52:26 +00:00
parent 2708743345
commit bfaf142ff6
3 changed files with 68 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos32_machdep.c,v 1.3 2001/06/05 14:43:04 mrg Exp $ */
/* $NetBSD: sunos32_machdep.c,v 1.4 2001/09/20 20:52:26 thorpej Exp $ */
/* from: NetBSD: sunos_machdep.c,v 1.14 2001/01/29 01:37:56 mrg Exp */
/*
@ -80,6 +80,67 @@ struct sunos32_sigframe {
struct sunos32_sigcontext sf_sc; /* actual sigcontext */
};
/*
* Set up registers on exec.
*
* XXX this entire mess must be fixed
*/
/* ARGSUSED */
void
sunos32_setregs(p, pack, stack)
struct proc *p;
struct exec_package *pack;
u_long stack; /* XXX */
{
register struct trapframe64 *tf = p->p_md.md_tf;
register struct fpstate64 *fs;
register int64_t tstate;
/* Don't allow misaligned code by default */
p->p_md.md_flags &= ~MDP_FIXALIGN;
/* Mark this as a 32-bit emulation */
p->p_flag |= P_32;
/* Setup the coredump32 and ev_out32 hook's */
if (coredump32_hook == NULL)
coredump32_hook = coredump32;
if (ev_out32_hook == NULL)
ev_out32_hook = ev_out32;
/*
* Set the registers to 0 except for:
* %o6: stack pointer, built in exec())
* %tstate: (retain icc and xcc and cwp bits)
* %g1: address of PS_STRINGS (used by crt0)
* %tpc,%tnpc: entry point of program
*/
tstate = ((PSTATE_USER32)<<TSTATE_PSTATE_SHIFT)
| (tf->tf_tstate & TSTATE_CWP);
if ((fs = p->p_md.md_fpstate) != NULL) {
/*
* We hold an FPU state. If we own *the* FPU chip state
* we must get rid of it, and the only way to do that is
* to save it. In any case, get rid of our FPU state.
*/
if (p == fpproc) {
savefpstate(fs);
fpproc = NULL;
}
free((void *)fs, M_SUBPROC);
p->p_md.md_fpstate = NULL;
}
bzero((caddr_t)tf, sizeof *tf);
tf->tf_tstate = tstate;
tf->tf_global[1] = (u_int)(u_long)p->p_psstr;
tf->tf_pc = pack->ep_entry & ~3;
tf->tf_npc = tf->tf_pc + 4;
stack -= sizeof(struct rwindow32);
tf->tf_out[6] = stack;
tf->tf_out[7] = NULL;
}
void
sunos32_sendsig(catcher, sig, mask, code)
sig_t catcher;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos32_exec.c,v 1.8 2001/09/18 19:36:41 jdolecek Exp $ */
/* $NetBSD: sunos32_exec.c,v 1.9 2001/09/20 20:52:26 thorpej Exp $ */
/*
* Copyright (c) 2001 Matthew R. Green
@ -38,6 +38,7 @@
#include <compat/sunos32/sunos32.h>
#include <compat/sunos32/sunos32_syscall.h>
#include <compat/sunos32/sunos32_exec.h>
extern int nsunos32_sysent;
extern struct sysent sunos32_sysent[];
@ -64,7 +65,7 @@ struct emul emul_sunos = {
trapsignal,
sunos_sigcode,
sunos_esigcode,
netbsd32_setregs,
sunos32_setregs,
NULL,
NULL,
NULL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos32_exec.h,v 1.2 2001/02/08 12:32:41 mrg Exp $ */
/* $NetBSD: sunos32_exec.h,v 1.3 2001/09/20 20:52:26 thorpej Exp $ */
/*
* Copyright (c) 2001 Matthew R. Green
@ -36,5 +36,7 @@
extern const struct emul emul_sunos;
int exec_sunos32_aout_makecmds __P((struct proc *, struct exec_package *));
void sunos32_setregs __P((struct proc *p, struct exec_package *pack,
u_long stack));
#endif /* _SUNOS32_EXEC_H_ */