Have targets register a helper to resolve their exceptions.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
include/hw/core/cpu.h | 2 ++
accel/tcg/cpu-exec-common.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 328e30045ce..1d73cc69af8 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -105,6 +105,7 @@ struct SysemuCPUOps;
* @list_cpus: list available CPU models and flags.
* @parse_features: Callback to parse command line arguments.
* @reset_dump_flags: #CPUDumpFlags to use for reset logging.
+ * @exception_name: Callback for getting architecture exception name.
* @memory_rw_debug: Callback for GDB memory access.
* @dump_state: Callback for dumping state.
* @query_cpu_fast:
@@ -175,6 +176,7 @@ struct CPUClass {
const char * (*gdb_arch_name)(CPUState *cpu);
const char * (*gdb_get_core_xml_file)(CPUState *cpu);
+ const char *(*exception_name)(int exception);
void (*disas_set_info)(const CPUState *cpu, disassemble_info *info);
const char *deprecation_note;
diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c
index 2ac8380d0bb..12cac8aec3c 100644
--- a/accel/tcg/cpu-exec-common.c
+++ b/accel/tcg/cpu-exec-common.c
@@ -117,6 +117,12 @@ static void log_raise_exception(const CPUState *cpu, int
excp)
if (excp >= EXCP_QEMU_INTERNAL) {
qemu_log_mask(CPU_LOG_INT, "raise exception: 0x%x (internal: %s)\n",
excp, qemu_excp_name(excp));
+ } else {
+ const CPUClass *cc = cpu->cc;
+ const char *name = cc->exception_name ? cc->exception_name(excp)
+ : "undocumented";
+
+ qemu_log_mask(CPU_LOG_INT, "raise exception: %d (%s)\n", excp, name);
}
}
--
2.55.0