Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Add sunos32_setregs(), thus making sunos32 compile again.



details:   https://anonhg.NetBSD.org/src/rev/b0dec126207d
branches:  trunk
changeset: 515253:b0dec126207d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Sep 20 20:52:26 2001 +0000

description:
Add sunos32_setregs(), thus making sunos32 compile again.

diffstat:

 sys/arch/sparc64/sparc64/sunos32_machdep.c |  63 +++++++++++++++++++++++++++++-
 sys/compat/sunos32/sunos32_exec.c          |   5 +-
 sys/compat/sunos32/sunos32_exec.h          |   4 +-
 3 files changed, 68 insertions(+), 4 deletions(-)

diffs (120 lines):

diff -r ba6aa3d5c1e0 -r b0dec126207d sys/arch/sparc64/sparc64/sunos32_machdep.c
--- a/sys/arch/sparc64/sparc64/sunos32_machdep.c        Thu Sep 20 20:28:41 2001 +0000
+++ b/sys/arch/sparc64/sparc64/sunos32_machdep.c        Thu Sep 20 20:52:26 2001 +0000
@@ -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_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;
diff -r ba6aa3d5c1e0 -r b0dec126207d sys/compat/sunos32/sunos32_exec.c
--- a/sys/compat/sunos32/sunos32_exec.c Thu Sep 20 20:28:41 2001 +0000
+++ b/sys/compat/sunos32/sunos32_exec.c Thu Sep 20 20:52:26 2001 +0000
@@ -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 @@
        trapsignal,
        sunos_sigcode,
        sunos_esigcode,
-       netbsd32_setregs,
+       sunos32_setregs,
        NULL,
        NULL,
        NULL,
diff -r ba6aa3d5c1e0 -r b0dec126207d sys/compat/sunos32/sunos32_exec.h
--- a/sys/compat/sunos32/sunos32_exec.h Thu Sep 20 20:28:41 2001 +0000
+++ b/sys/compat/sunos32/sunos32_exec.h Thu Sep 20 20:52:26 2001 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index