diff --git a/target/cr16c/helper.c b/target/cr16c/helper.c index 17b997e059..53a088b640 100644 --- a/target/cr16c/helper.c +++ b/target/cr16c/helper.c @@ -21,3 +21,8 @@ void helper_raise_unimplemented_instruction(void) { void helper_exit(CPUCR16CState *env) { exit(env->r[0]); } + +void helper_dump_regs(CPUCR16CState* env) { + qemu_printf("State dump requested:\n"); + cr16c_debug_dump_state(env_cpu(env)); +} diff --git a/target/cr16c/helper.h b/target/cr16c/helper.h index cb1ffd1699..2c9d962887 100644 --- a/target/cr16c/helper.h +++ b/target/cr16c/helper.h @@ -1,3 +1,4 @@ DEF_HELPER_1(raise_illegal_instruction, void, env); DEF_HELPER_0(raise_unimplemented_instruction, void); DEF_HELPER_1(exit, void, env); +DEF_HELPER_1(dump_regs, void, env); diff --git a/target/cr16c/translate.c b/target/cr16c/translate.c index 5e40a8759f..691c0a73e0 100644 --- a/target/cr16c/translate.c +++ b/target/cr16c/translate.c @@ -1187,6 +1187,10 @@ static bool trans_TBIT_reg_reg(DisasContext *ctx, arg_TBIT_reg_reg *a) { /* For now this instruction is abused as semihosting instruction for tests */ static bool trans_EXCP(DisasContext *ctx, arg_EXCP *a) { + if (a->id == 14) {// DBG + gen_helper_dump_regs(tcg_env); + return true; + } gen_helper_exit(tcg_env); ctx->base.is_jmp = DISAS_NORETURN;