target-alpha: Set PC correctly for floating-point exceptions
authorRichard Henderson <rth@twiddle.net>
Sat, 28 Jun 2014 20:06:19 +0000 (13:06 -0700)
committerRichard Henderson <rth@twiddle.net>
Mon, 18 May 2015 20:03:46 +0000 (13:03 -0700)
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>
target-alpha/helper.c
target-alpha/mem_helper.c

index a8aa782a2addf5dea891d2d9da4107ef38f3bd1f..e202fee659c73162a5a95db5e3aefadf6b510529 100644 (file)
@@ -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);
 }
index fc4f57a64478d17863a8dedaff60782b00ec8908..7b5e30ddb7f0cabd4c924713affa6f038e633215 100644 (file)
@@ -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