@@ -2819,9 +2819,6 @@ void cpu_write_xer(CPUPPCState *env, target_ulong xer);
*/
#define is_book3s_arch2x(ctx) (!!((ctx)->insns_flags & PPC_SEGMENT_64B))
-G_NORETURN void raise_exception_err_ra(CPUPPCState *env, uint32_t exception,
- uint32_t error_code, uintptr_t raddr);
-
/* PERFM EBB helper*/
#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
void raise_ebb_perfm_exception(CPUPPCState *env);
@@ -1,5 +1,3 @@
-DEF_HELPER_FLAGS_3(raise_exception_err, TCG_CALL_NO_WG, noreturn, env, i32, i32)
-DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, i32)
DEF_HELPER_FLAGS_4(TW, TCG_CALL_NO_WG, void, env, tl, tl, i32)
#if defined(TARGET_PPC64)
DEF_HELPER_FLAGS_4(TD, TCG_CALL_NO_WG, void, env, tl, tl, i32)
@@ -320,8 +320,17 @@ static inline int ger_pack_masks(int pmsk, int ymsk, int xmsk)
#ifdef CONFIG_TCG
#include "accel/tcg/tb-cpu-state.h"
+#include "accel/tcg/cpu-loop.h"
TCGTBCPUState ppc_get_tb_cpu_state(CPUState *cs);
+
+static inline G_NORETURN
+void raise_exception_err_ra(CPUPPCState *env, uint32_t excp,
+ uint32_t err, uintptr_t ra)
+{
+ env->error_code = err;
+ cpu_loop_exit_excp(env_cpu(env), excp, ra);
+}
#endif
#endif /* PPC_INTERNAL_H */
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qemu/log.h"
#include "cpu.h"
+#include "internal.h"
#include "exec/cputlb.h"
#include "exec/helper-proto.h"
#include "qemu/error-report.h"
@@ -34,27 +34,6 @@
/*****************************************************************************/
/* Exceptions processing helpers */
-void raise_exception_err_ra(CPUPPCState *env, uint32_t exception,
- uint32_t error_code, uintptr_t raddr)
-{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = exception;
- env->error_code = error_code;
- cpu_loop_exit_restore(cs, raddr);
-}
-
-void helper_raise_exception_err(CPUPPCState *env, uint32_t exception,
- uint32_t error_code)
-{
- raise_exception_err_ra(env, exception, error_code, 0);
-}
-
-void helper_raise_exception(CPUPPCState *env, uint32_t exception)
-{
- raise_exception_err_ra(env, exception, 0, 0);
-}
-
#ifndef CONFIG_USER_ONLY
static G_NORETURN void raise_exception_err(CPUPPCState *env, uint32_t exception,
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "cpu.h"
+#include "internal.h"
#include "hw/ppc/ppc.h"
#include "exec/helper-proto.h"
#include "qemu/log.h"
@@ -308,12 +308,10 @@ static inline void gen_update_nip(DisasContext *ctx, target_ulong nip)
static void gen_exception_err_nip(DisasContext *ctx, uint32_t excp,
uint32_t error, target_ulong nip)
{
- TCGv_i32 t0, t1;
-
gen_update_nip(ctx, nip);
- t0 = tcg_constant_i32(excp);
- t1 = tcg_constant_i32(error);
- gen_helper_raise_exception_err(tcg_env, t0, t1);
+ tcg_gen_st_i32(tcg_constant_i32(error), tcg_env,
+ offsetof(CPUPPCState, error_code));
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp));
ctx->base.is_jmp = DISAS_NORETURN;
}
@@ -372,8 +370,9 @@ static void gen_debug_exception(DisasContext *ctx, bool rfi_type)
gen_load_spr(t0, SPR_BOOKE_DBSR);
tcg_gen_ori_tl(t0, t0, dbsr);
gen_store_spr(SPR_BOOKE_DBSR, t0);
- gen_helper_raise_exception(tcg_env,
- tcg_constant_i32(POWERPC_EXCP_DEBUG));
+ tcg_gen_st_i32(tcg_constant_i32(0), tcg_env,
+ offsetof(CPUPPCState, error_code));
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(POWERPC_EXCP_DEBUG));
ctx->base.is_jmp = DISAS_NORETURN;
} else {
if (!rfi_type) { /* BookS does not single step rfi type instructions */
Store error_code, then call raise_excp. Drop TCG raise_exception and raise_exception_err. Move C raise_exception_err_ra to static inline in internal.h, and remove the cpu.h prototype. Callers include internal.h. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- target/ppc/cpu.h | 3 --- target/ppc/helper.h | 2 -- target/ppc/internal.h | 9 +++++++++ target/ppc/misc_helper.c | 1 + target/ppc/tcg-excp_helper.c | 21 --------------------- target/ppc/timebase_helper.c | 1 + target/ppc/translate.c | 13 ++++++------- 7 files changed, 17 insertions(+), 33 deletions(-)