@@ -27,26 +27,12 @@
void cpu_raise_exception_ra(CPUSPARCState *env, int tt, uintptr_t ra)
{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = tt;
- cpu_loop_exit_restore(cs, ra);
-}
-
-void helper_raise_exception(CPUSPARCState *env, int tt)
-{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = tt;
- cpu_loop_exit(cs);
+ cpu_raise_excp_restore(env_cpu(env), tt, ra);
}
void helper_debug(CPUSPARCState *env)
{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = EXCP_DEBUG;
- cpu_loop_exit(cs);
+ cpu_raise_excp(env_cpu(env), EXCP_DEBUG);
}
#ifdef TARGET_SPARC64
@@ -208,10 +194,9 @@ void helper_power_down(CPUSPARCState *env)
CPUState *cs = env_cpu(env);
cs->halted = 1;
- cs->exception_index = EXCP_HLT;
env->pc = env->npc;
env->npc = env->pc + 4;
- cpu_loop_exit(cs);
+ cpu_raise_excp(cs, EXCP_HLT);
}
target_ulong helper_rdasr17(CPUSPARCState *env)
@@ -53,8 +53,6 @@ DEF_HELPER_FLAGS_3(fcmpq, TCG_CALL_NO_WG, i32, env, i128, i128)
DEF_HELPER_FLAGS_3(fcmpeq, TCG_CALL_NO_WG, i32, env, i128, i128)
DEF_HELPER_FLAGS_3(flcmps, TCG_CALL_NO_RWG_SE, i32, env, f32, f32)
DEF_HELPER_FLAGS_3(flcmpd, TCG_CALL_NO_RWG_SE, i32, env, f64, f64)
-DEF_HELPER_2(raise_exception, noreturn, env, int)
-
DEF_HELPER_FLAGS_3(faddd, TCG_CALL_NO_WG, f64, env, f64, f64)
DEF_HELPER_FLAGS_3(fsubd, TCG_CALL_NO_WG, f64, env, f64, f64)
DEF_HELPER_FLAGS_3(fmuld, TCG_CALL_NO_WG, f64, env, f64, f64)
@@ -1048,7 +1048,7 @@ static void gen_exception(DisasContext *dc, int which)
{
finishing_insn(dc);
save_state(dc);
- gen_helper_raise_exception(tcg_env, tcg_constant_i32(which));
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(which));
dc->base.is_jmp = DISAS_NORETURN;
}
@@ -2811,7 +2811,7 @@ static bool do_tcc(DisasContext *dc, int cond, int cc,
/* Trap always. */
if (cond == 8) {
save_state(dc);
- gen_helper_raise_exception(tcg_env, trap);
+ gen_helper_raise_excp(tcg_env, trap);
dc->base.is_jmp = DISAS_NORETURN;
return true;
}
@@ -5833,7 +5833,7 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
if (e->npc % 4 == 0) {
tcg_gen_movi_tl(cpu_npc, e->npc);
}
- gen_helper_raise_exception(tcg_env, e->excp);
+ gen_helper_raise_excp(tcg_env, e->excp);
e_next = e->next;
g_free(e);
Use the shared raise_excp helper for translated exceptions and adapt SPARC C exits to cpu_raise_excp() or cpu_raise_excp_restore() according to the return-address contract. Keep cpu_raise_exception_ra(). Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- target/sparc/helper.c | 21 +++------------------ target/sparc/helper.h | 2 -- target/sparc/translate.c | 6 +++--- 3 files changed, 6 insertions(+), 23 deletions(-)