aboutsummaryrefslogtreecommitdiff
path: root/target-mips
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2012-10-28 15:42:55 +0100
committerAurelien Jarno <aurelien@aurel32.net>2012-10-31 22:20:45 +0100
commit4636401d99c113c67229ceabe93666767a619a25 (patch)
tree3fb82da26075c17ec8a7c8017d36e1cecc32f76b /target-mips
parentb3a1be87bac3a6aaa59bb88c1410f170dc9b22d5 (diff)
target-mips: correctly restore btarget upon exception
When the CPU state is restored through retranslation after an exception, btarget should also be restored. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'target-mips')
-rw-r--r--target-mips/translate.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 6dc2b62844..bf2cb0ba7c 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -1015,6 +1015,7 @@ static TCGv_i32 fpu_fcr0, fpu_fcr31;
static TCGv_i64 fpu_f64[32];
static uint32_t gen_opc_hflags[OPC_BUF_SIZE];
+static target_ulong gen_opc_btarget[OPC_BUF_SIZE];
#include "gen-icount.h"
@@ -15581,6 +15582,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,
}
gen_opc_pc[lj] = ctx.pc;
gen_opc_hflags[lj] = ctx.hflags & MIPS_HFLAG_BMASK;
+ gen_opc_btarget[lj] = ctx.btarget;
gen_opc_instr_start[lj] = 1;
gen_opc_icount[lj] = num_insns;
}
@@ -16001,4 +16003,13 @@ void restore_state_to_opc(CPUMIPSState *env, TranslationBlock *tb, int pc_pos)
env->active_tc.PC = gen_opc_pc[pc_pos];
env->hflags &= ~MIPS_HFLAG_BMASK;
env->hflags |= gen_opc_hflags[pc_pos];
+ switch (env->hflags & MIPS_HFLAG_BMASK_BASE) {
+ case MIPS_HFLAG_BR:
+ break;
+ case MIPS_HFLAG_BC:
+ case MIPS_HFLAG_BL:
+ case MIPS_HFLAG_B:
+ env->btarget = gen_opc_btarget[pc_pos];
+ break;
+ }
}