summaryrefslogtreecommitdiff
path: root/sys/arch/m88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-11-27 20:46:49 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-11-27 20:46:49 +0000
commit9f40edd8a7f4ae3356a04fd6e4ac4494ff0343ac (patch)
treee1d24c6ccd676e69e8a70941284440f0f148cb19 /sys/arch/m88k
parent87b165869aec45793dcb73f5154188c25deba794 (diff)
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid
(i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c15
-rw-r--r--sys/arch/m88k/m88k/trap.c4
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index 2d20ef838b0..be41eeb193a 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.41 2007/12/26 22:21:39 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.42 2008/11/27 20:46:48 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -178,9 +178,20 @@ setregs(p, pack, stack, retval)
#ifdef M88100
if (CPU_IS88100) {
/*
- * m88100_syscall() will resume at sfip / sfip + 4.
+ * m88100_syscall() will resume at sfip / sfip + 4...
*/
tf->tf_sfip = ((pack->ep_entry + 8) & FIP_ADDR) | FIP_V;
+
+ /*
+ * ... unless we are starting init, in which case we
+ * won't be returning through the regular path, and
+ * need to explicitely set up nip and fip (note that
+ * 88110 do not need such a test).
+ */
+ if (p->p_pid == 1) {
+ tf->tf_snip = tf->tf_sfip;
+ tf->tf_sfip += 4;
+ }
}
#endif
tf->tf_r[2] = retval[0] = stack;
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index b8f35945129..b2137b3132e 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.63 2008/05/02 21:44:46 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.64 2008/11/27 20:46:48 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -1454,7 +1454,7 @@ child_return(arg)
/* skip br instruction as in syscall() */
#ifdef M88100
if (CPU_IS88100) {
- tf->tf_snip = tf->tf_sfip & XIP_ADDR;
+ tf->tf_snip = (tf->tf_sfip & XIP_ADDR) | XIP_V;
tf->tf_sfip = tf->tf_snip + 4;
}
#endif