@@ -152,14 +152,6 @@ bool avr_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
* helpers
*/
-void helper_sleep(CPUAVRState *env)
-{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = EXCP_HLT;
- cpu_loop_exit(cs);
-}
-
void helper_unsupported(CPUAVRState *env)
{
CPUState *cs = env_cpu(env);
@@ -176,22 +168,6 @@ void helper_unsupported(CPUAVRState *env)
cpu_loop_exit(cs);
}
-void helper_debug(CPUAVRState *env)
-{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = EXCP_DEBUG;
- cpu_loop_exit(cs);
-}
-
-void helper_break(CPUAVRState *env)
-{
- CPUState *cs = env_cpu(env);
-
- cs->exception_index = EXCP_DEBUG;
- cpu_loop_exit(cs);
-}
-
void helper_wdr(CPUAVRState *env)
{
qemu_log_mask(LOG_UNIMP, "WDG reset (not implemented)\n");
@@ -19,8 +19,5 @@
*/
DEF_HELPER_1(wdr, void, env)
-DEF_HELPER_1(debug, noreturn, env)
-DEF_HELPER_1(break, noreturn, env)
-DEF_HELPER_1(sleep, noreturn, env)
DEF_HELPER_1(unsupported, noreturn, env)
DEF_HELPER_3(fullwr, void, env, i32, i32)
@@ -2554,7 +2554,7 @@ static bool trans_BREAK(DisasContext *ctx, arg_BREAK *a)
#ifdef BREAKPOINT_ON_BREAK
tcg_gen_movi_tl(cpu_pc, ctx->npc - 1);
- gen_helper_debug(tcg_env);
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(EXCP_DEBUG));
ctx->base.is_jmp = DISAS_EXIT;
#else
/* NOP */
@@ -2580,7 +2580,7 @@ static bool trans_NOP(DisasContext *ctx, arg_NOP *a)
*/
static bool trans_SLEEP(DisasContext *ctx, arg_SLEEP *a)
{
- gen_helper_sleep(tcg_env);
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(EXCP_HLT));
ctx->base.is_jmp = DISAS_NORETURN;
return true;
}
Use the shared raise_excp helper for AVR debug, break, and sleep exceptions while preserving target-specific unsupported handling. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- target/avr/helper.c | 24 ------------------------ target/avr/helper.h | 3 --- target/avr/translate.c | 4 ++-- 3 files changed, 2 insertions(+), 29 deletions(-)