@@ -1,7 +1,3 @@
-DEF_HELPER_3(raise_exception_err, noreturn, env, i32, int)
-DEF_HELPER_2(raise_exception, noreturn, env, i32)
-DEF_HELPER_1(raise_exception_debug, noreturn, env)
-
#ifdef TARGET_MIPS64
DEF_HELPER_4(sdl, void, env, tl, tl, int)
DEF_HELPER_4(sdr, void, env, tl, tl, int)
@@ -44,22 +44,6 @@ target_ulong exception_resume_pc(CPUMIPSState *env)
return bad_pc;
}
-void helper_raise_exception_err(CPUMIPSState *env, uint32_t exception,
- int error_code)
-{
- do_raise_exception_err(env, exception, error_code, 0);
-}
-
-void helper_raise_exception(CPUMIPSState *env, uint32_t exception)
-{
- do_raise_exception(env, exception, GETPC());
-}
-
-void helper_raise_exception_debug(CPUMIPSState *env)
-{
- do_raise_exception(env, EXCP_DEBUG, 0);
-}
-
static void raise_exception(CPUMIPSState *env, uint32_t exception)
{
do_raise_exception(env, exception, 0);
@@ -145,8 +129,6 @@ void do_raise_exception_err(CPUMIPSState *env, uint32_t exception,
qemu_log_mask(CPU_LOG_INT, "%s: %d (%s) %d\n",
__func__, exception, mips_exception_name(exception),
error_code);
- cs->exception_index = exception;
env->error_code = error_code;
-
- cpu_loop_exit_restore(cs, pc);
+ cpu_loop_exit_excp(cs, exception, pc);
}
@@ -61,7 +61,7 @@ target_ulong helper_cfc1(CPUMIPSState *env, uint32_t reg)
if (env->CP0_Config5 & (1 << CP0C5_UFE)) {
arg1 = (env->CP0_Config5 >> CP0C5_FRE) & 1;
} else {
- helper_raise_exception(env, EXCP_RI);
+ do_raise_exception(env, EXCP_RI, GETPC());
}
}
break;
@@ -120,7 +120,7 @@ void helper_ctc1(CPUMIPSState *env, target_ulong arg1, uint32_t fs, uint32_t rt)
env->CP0_Config5 &= ~(1 << CP0C5_FRE);
compute_hflags(env);
} else {
- helper_raise_exception(env, EXCP_RI);
+ do_raise_exception(env, EXCP_RI, GETPC());
}
break;
case 6:
@@ -132,7 +132,7 @@ void helper_ctc1(CPUMIPSState *env, target_ulong arg1, uint32_t fs, uint32_t rt)
env->CP0_Config5 |= (1 << CP0C5_FRE);
compute_hflags(env);
} else {
- helper_raise_exception(env, EXCP_RI);
+ do_raise_exception(env, EXCP_RI, GETPC());
}
break;
case 25:
@@ -1316,14 +1316,17 @@ static inline void restore_cpu_state(CPUMIPSState *env, DisasContext *ctx)
void generate_exception_err(DisasContext *ctx, int excp, int err)
{
save_cpu_state(ctx, 1);
- gen_helper_raise_exception_err(tcg_env, tcg_constant_i32(excp),
- tcg_constant_i32(err));
+ tcg_gen_st_i32(tcg_constant_i32(err), tcg_env,
+ offsetof(CPUMIPSState, error_code));
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp));
ctx->base.is_jmp = DISAS_NORETURN;
}
void generate_exception(DisasContext *ctx, int excp)
{
- gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp));
+ tcg_gen_st_i32(tcg_constant_i32(0), tcg_env,
+ offsetof(CPUMIPSState, error_code));
+ gen_helper_raise_excp_restore(tcg_env, tcg_constant_i32(excp));
}
void generate_exception_end(DisasContext *ctx, int excp)
Store error_code, then call raise_excp for the err path and raise_excp_restore for the 2-arg path. Drop TCG raise_exception, raise_exception_err, and the unused debug DEF. Keep C do_raise_exception_err via cpu_loop_exit_excp. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- target/mips/helper.h | 4 ---- target/mips/tcg/exception.c | 20 +------------------- target/mips/tcg/fpu_helper.c | 6 +++--- target/mips/tcg/translate.c | 9 ++++++--- 4 files changed, 10 insertions(+), 29 deletions(-)