aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-06-28 13:06:19 -0700
committerRichard Henderson <rth@twiddle.net>2015-05-18 13:03:46 -0700
commitba9c5de5f2d33d468a07a8794121472ea031a0b5 (patch)
treef0efcd2cad8edba21b68e0b0feb41959b5454f66
parent9d5a626b2c3fa98761b35b5e2ac86f7adb231002 (diff)
target-alpha: Set PC correctly for floating-point exceptions
PC should be one past the faulting insn. Add better commentary for the machine-check exception path. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Richard Henderson <rth@twiddle.net>
-rw-r--r--target-alpha/helper.c2
-rw-r--r--target-alpha/mem_helper.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/target-alpha/helper.c b/target-alpha/helper.c
index a8aa782a2a..e202fee659 100644
--- a/target-alpha/helper.c
+++ b/target-alpha/helper.c
@@ -571,6 +571,8 @@ void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, uintptr_t retaddr,
env->error_code = error;
if (retaddr) {
cpu_restore_state(cs, retaddr);
+ /* Floating-point exceptions (our only users) point to the next PC. */
+ env->pc += 4;
}
cpu_loop_exit(cs);
}
diff --git a/target-alpha/mem_helper.c b/target-alpha/mem_helper.c
index fc4f57a644..7b5e30ddb7 100644
--- a/target-alpha/mem_helper.c
+++ b/target-alpha/mem_helper.c
@@ -128,7 +128,14 @@ void alpha_cpu_unassigned_access(CPUState *cs, hwaddr addr,
env->trap_arg0 = addr;
env->trap_arg1 = is_write ? 1 : 0;
- dynamic_excp(env, 0, EXCP_MCHK, 0);
+ cs->exception_index = EXCP_MCHK;
+ env->error_code = 0;
+
+ /* ??? We should cpu_restore_state to the faulting insn, but this hook
+ does not have access to the retaddr value from the orignal helper.
+ It's all moot until the QEMU PALcode grows an MCHK handler. */
+
+ cpu_loop_exit(cs);
}
/* try to fill the TLB and return an exception if error. If retaddr is