wip! hack! dump_regs "semihosting" helper through excp dbg

This commit is contained in:
fridtjof 2025-08-14 01:17:51 +02:00
parent 0fc68742a3
commit 7b0d3b1a53
3 changed files with 10 additions and 0 deletions

View file

@ -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));
}

View file

@ -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);

View file

@ -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;