Expose m68k_exception_name() prototype and register it as the CPUClass::exception_name() handler, so the common exception logging can resolve M68k exception codes to names.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- target/m68k/cpu.h | 2 ++ target/m68k/cpu.c | 1 + target/m68k/op_helper.c | 8 ++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 7cf3791108c..44b4afc41c6 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -69,6 +69,8 @@ #define EXCP_RTE 0x100 #define EXCP_SEMIHOSTING 0x101 +const char *m68k_exception_name(int excp); + #define M68K_DTTR0 0 #define M68K_DTTR1 1 #define M68K_ITTR0 2 diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 9b52ad5fc23..7d5dfd8e529 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -730,6 +730,7 @@ static void m68k_cpu_class_init(ObjectClass *c, const void *data) &mcc->parent_phases); cc->class_by_name = m68k_cpu_class_by_name; + cc->exception_name = m68k_exception_name; cc->dump_state = m68k_cpu_dump_state; cc->set_pc = m68k_cpu_set_pc; cc->get_pc = m68k_cpu_get_pc; diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 38f7a689814..c600f83ddbf 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -80,9 +80,11 @@ throwaway: cpu_m68k_set_sr(env, sr); } -static const char *m68k_exception_name(int index) +#endif /* !CONFIG_USER_ONLY */ + +const char *m68k_exception_name(int excp) { - switch (index) { + switch (excp) { case EXCP_ACCESS: return "Access Fault"; case EXCP_ADDRESS: @@ -185,6 +187,8 @@ static const char *m68k_exception_name(int index) return "Unassigned"; } +#ifndef CONFIG_USER_ONLY + static void do_plugin_vcpu_interrupt_cb(CPUState *cs, uint64_t from) { switch (cs->exception_index) { -- 2.55.0
