diff --git a/qemu/target-mips/translate.c b/qemu/target-mips/translate.c index 3132bd34..59710758 100644 --- a/qemu/target-mips/translate.c +++ b/qemu/target-mips/translate.c @@ -19662,7 +19662,8 @@ void cpu_state_reset(CPUMIPSState *env) if (env->hflags & MIPS_HFLAG_BMASK) { /* If the exception was raised from a delay slot, come back to the jump. */ - env->CP0_ErrorEPC = env->active_tc.PC - 4; + env->CP0_ErrorEPC = (env->active_tc.PC + - (env->hflags & MIPS_HFLAG_B16 ? 2 : 4)); } else { env->CP0_ErrorEPC = env->active_tc.PC; } diff --git a/qemu/translate-all.c b/qemu/translate-all.c index 1a96c343..cb6ebd96 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -1579,7 +1579,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) branch. */ #if defined(TARGET_MIPS) if ((env->hflags & MIPS_HFLAG_BMASK) != 0 && n > 1) { - env->active_tc.PC -= 4; + env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); cpu->icount_decr.u16.low++; env->hflags &= ~MIPS_HFLAG_BMASK; }