summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-05-31 11:19:07 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-05-31 11:19:07 +0000
commit2e4f3cfb96cbcbb74faccfc851230668bb4d10c4 (patch)
tree4f891167d68b4deb60b1a1d39297b02f8e6d5a0f /sys
parent349868a24312997acd650d340d3532cb013a0be4 (diff)
Introduce m88100_rewind_insn() to rewind the execution pipeline one
instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible. No functional change.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/m88k/include/m88100.h10
-rw-r--r--sys/arch/m88k/m88k/db_interface.c8
-rw-r--r--sys/arch/m88k/m88k/m88100_machdep.c6
-rw-r--r--sys/arch/m88k/m88k/trap.c34
4 files changed, 29 insertions, 29 deletions
diff --git a/sys/arch/m88k/include/m88100.h b/sys/arch/m88k/include/m88100.h
index 7841b3e5ece..1f9d371ec89 100644
--- a/sys/arch/m88k/include/m88100.h
+++ b/sys/arch/m88k/include/m88100.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88100.h,v 1.8 2013/08/18 22:17:26 miod Exp $ */
+/* $OpenBSD: m88100.h,v 1.9 2014/05/31 11:19:06 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -68,6 +68,14 @@ u_int8_t do_xmem_byte(vaddr_t, u_int8_t, int);
void m88100_apply_patches(void);
void m88100_smp_setup(struct cpu_info *);
+/* rewind one instruction */
+static __inline__ void
+m88100_rewind_insn(struct reg *regs)
+{
+ regs->sfip = regs->snip;
+ regs->snip = regs->sxip;
+}
+
#endif
#endif /* _M88K_M88100_H_ */
diff --git a/sys/arch/m88k/m88k/db_interface.c b/sys/arch/m88k/m88k/db_interface.c
index 2ecd2250621..3014d8bd790 100644
--- a/sys/arch/m88k/m88k/db_interface.c
+++ b/sys/arch/m88k/m88k/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.19 2014/05/08 22:17:33 miod Exp $ */
+/* $OpenBSD: db_interface.c,v 1.20 2014/05/31 11:19:06 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -463,10 +463,8 @@ ddb_break_trap(type, eframe)
* at the breakpoint address. mc88110's exip reg
* already has the address of the exception instruction.
*/
- if (CPU_IS88100) {
- eframe->sfip = eframe->snip;
- eframe->snip = eframe->sxip;
- }
+ if (CPU_IS88100)
+ m88100_rewind_insn(eframe);
}
return 0;
diff --git a/sys/arch/m88k/m88k/m88100_machdep.c b/sys/arch/m88k/m88k/m88100_machdep.c
index 55ed78ad7a4..83a7775422e 100644
--- a/sys/arch/m88k/m88k/m88100_machdep.c
+++ b/sys/arch/m88k/m88k/m88100_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88100_machdep.c,v 1.11 2013/08/24 20:54:29 miod Exp $ */
+/* $OpenBSD: m88100_machdep.c,v 1.12 2014/05/31 11:19:06 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -295,9 +295,7 @@ dae_process(struct trapframe *eframe, u_int x,
if (x == 0) {
if (reg != 0)
eframe->tf_r[reg] = dmdx;
- eframe->tf_sfip = eframe->tf_snip;
- eframe->tf_snip = eframe->tf_sxip;
- eframe->tf_sxip = 0;
+ m88100_rewind_insn(&(eframe->tf_regs));
/* xmem RERUN ON rte */
eframe->tf_dmt0 = 0;
return;
diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c
index 5e95bb0c829..84a6c5ac594 100644
--- a/sys/arch/m88k/m88k/trap.c
+++ b/sys/arch/m88k/m88k/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.94 2014/05/26 17:31:17 miod Exp $ */
+/* $OpenBSD: trap.c,v 1.95 2014/05/31 11:19:06 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -356,7 +356,6 @@ lose:
*/
frame->tf_snip = pcb_onfault | NIP_V;
frame->tf_sfip = (pcb_onfault + 4) | FIP_V;
- frame->tf_sxip = 0;
/*
* Continue as if the fault had been resolved,
* but do not try to complete the faulting
@@ -436,12 +435,10 @@ user_fault:
if (result == 0) {
if (type == T_INSTFLT + T_USER) {
- /*
- * back up SXIP, SNIP,
- * clearing the Error bit
- */
- frame->tf_sfip = frame->tf_snip & ~FIP_E;
- frame->tf_snip = frame->tf_sxip & ~NIP_E;
+ m88100_rewind_insn(&(frame->tf_regs));
+ /* clear the error bit */
+ frame->tf_sfip &= ~FIP_E;
+ frame->tf_snip &= ~NIP_E;
frame->tf_ipfsr = 0;
} else {
/*
@@ -464,7 +461,6 @@ user_fault:
if (pcb_onfault != 0) {
frame->tf_snip = pcb_onfault | NIP_V;
frame->tf_sfip = (pcb_onfault + 4) | FIP_V;
- frame->tf_sxip = 0;
/*
* Continue as if the fault had been resolved,
* but do not try to complete the faulting
@@ -579,14 +575,13 @@ maysigfpe:
p->p_md.md_bp1va = 0;
}
-#if 1
- frame->tf_sfip = frame->tf_snip;
- frame->tf_snip = pc | NIP_V;
-#endif
+ m88100_rewind_insn(&(frame->tf_regs));
+ frame->tf_sxip = pc | NIP_V;
sig = SIGTRAP;
fault_type = TRAP_BRKPT;
}
#else
+ m88100_rewind_insn(&(frame->tf_regs));
sig = SIGTRAP;
fault_type = TRAP_TRACE;
#endif
@@ -598,8 +593,6 @@ maysigfpe:
* breakpoint debugging. When we get this trap, we just
* return a signal which gets caught by the debugger.
*/
- frame->tf_sfip = frame->tf_snip;
- frame->tf_snip = frame->tf_sxip;
sig = SIGTRAP;
fault_type = TRAP_BRKPT;
break;
@@ -1265,8 +1258,10 @@ m88100_syscall(register_t code, struct trapframe *tf)
tf->tf_sfip = tf->tf_snip + 4;
break;
case ERESTART:
- tf->tf_sfip = tf->tf_snip & ~FIP_E;
- tf->tf_snip = tf->tf_sxip & ~NIP_E;
+ m88100_rewind_insn(&(tf->tf_regs));
+ /* clear the error bit */
+ tf->tf_sfip &= ~FIP_E;
+ tf->tf_snip &= ~NIP_E;
break;
case EJUSTRETURN:
break;
@@ -1796,8 +1791,9 @@ cache_flush(struct trapframe *tf)
#ifdef M88100
if (CPU_IS88100) {
- tf->tf_snip = tf->tf_snip & ~NIP_E;
- tf->tf_sfip = tf->tf_sfip & ~FIP_E;
+ /* clear the error bit */
+ tf->tf_sfip &= ~FIP_E;
+ tf->tf_snip &= ~NIP_E;
}
#endif
#ifdef M88110