Skip to contentSkip to conversation

target-mips: fix CP0.BadVAddr by stopping translation on Address Error

PATCH New Leon Alrae 1 participant 1 message Mar 16, 2015

lore
Share & tools
lore

Leon Alrae

author
#0 lore raw

PATCH v2 1/1 target-mips: fix CP0.BadVAddr by stopping translation on Address Error

CP0.BadVAddr is supposed to capture the most recent virtual address that caused the exception. Currently this does not work correctly for unaligned instruction fetch as translation is not stopped and CP0.BadVAddr is updated with subsequent addresses.

---
v2:
* description update - make it clear that it is about instr. fetch (Maciej)

---
 target-mips/translate.c | 1 +
 1 file changed, 1 insertion(+)
target-mips/translate.c +1 -0
index 9059bfd..0e2443a 100644
@@ -18438,6 +18438,7 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx)
     if (ctx->pc & 0x3) {
         env->CP0_BadVAddr = ctx->pc;
         generate_exception_err(ctx, EXCP_AdEL, EXCP_INST_NOTAVAIL);
+        ctx->bstate = BS_STOP;
         return;
     }
 
Signature · 1 line
2.1.0