@@ -1,5 +1,3 @@
-DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32)
-
DEF_HELPER_FLAGS_3(divs, TCG_CALL_NO_WG, i32, env, i32, i32)
DEF_HELPER_FLAGS_3(divu, TCG_CALL_NO_WG, i32, env, i32, i32)
@@ -62,25 +62,14 @@ uint32_t helper_get(uint32_t id, uint32_t ctrl)
return 0xdead0000 | id;
}
-void helper_raise_exception(CPUMBState *env, uint32_t index)
-{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = index;
- cpu_loop_exit(cs);
-}
-
/* Raises ESR_EC_DIVZERO if exceptions are enabled. */
static void raise_divzero(CPUMBState *env, uint32_t esr, uintptr_t unwind_pc)
{
env->msr |= MSR_DZ;
if ((env->msr & MSR_EE) && env_archcpu(env)->cfg.div_zero_exception) {
- CPUState *cs = env_cpu(env);
-
env->esr = esr;
- cs->exception_index = EXCP_HW_EXCP;
- cpu_loop_exit_restore(cs, unwind_pc);
+ cpu_raise_excp_restore(env_cpu(env), EXCP_HW_EXCP, unwind_pc);
}
}
@@ -123,8 +112,7 @@ static void raise_fpu_exception(CPUMBState *env, uintptr_t ra)
CPUState *cs = env_cpu(env);
env->esr = ESR_EC_FPU;
- cs->exception_index = EXCP_HW_EXCP;
- cpu_loop_exit_restore(cs, ra);
+ cpu_raise_excp_restore(cs, EXCP_HW_EXCP, ra);
}
static void update_fpu_flags(CPUMBState *env, int flags, uintptr_t ra)
@@ -390,8 +378,7 @@ void helper_stackprot(CPUMBState *env, uint32_t addr)
env->ear = addr;
env->esr = ESR_EC_STACKPROT;
- cs->exception_index = EXCP_HW_EXCP;
- cpu_loop_exit_restore(cs, GETPC());
+ cpu_raise_excp_restore(cs, EXCP_HW_EXCP, GETPC());
}
}
@@ -100,7 +100,7 @@ static void t_sync_flags(DisasContext *dc)
static void gen_raise_exception(DisasContext *dc, uint32_t index)
{
- gen_helper_raise_exception(tcg_env, tcg_constant_i32(index));
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(index));
dc->base.is_jmp = DISAS_NORETURN;
}
Use the shared raise_excp helper for translated exceptions. Use cpu_raise_excp_restore() for GETPC() paths and preserve explicit cpu_loop_exit_restore() for MMU callbacks with possibly-zero retaddr. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- target/microblaze/helper.h | 2 -- target/microblaze/op_helper.c | 19 +++---------------- target/microblaze/translate.c | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-)