Register mips_exception_name() as the CPUClass::exception_name() handler, so the common exception logging can resolve MIPS exception codes to names. Return "unknown" for missing array entries. Remove the qemu_log_mask() call in do_raise_exception_err() because it would duplicate the one in log_raise_exception().
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- target/mips/cpu.h | 2 ++ target/mips/tcg/tcg-internal.h | 2 -- target/mips/cpu.c | 1 + target/mips/tcg/exception.c | 10 +++------- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 5d8b78a70b8..b080c5de4de 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1349,6 +1349,8 @@ enum { EXCP_SEMIHOST, }; +const char *mips_exception_name(int excp); + /* * This is an internally generated WAKE request line. * It is driven by the CPU itself. Raised when the MT diff --git a/target/mips/tcg/tcg-internal.h b/target/mips/tcg/tcg-internal.h index 950e6afc3f2..9f230e757d6 100644 --- a/target/mips/tcg/tcg-internal.h +++ b/target/mips/tcg/tcg-internal.h @@ -27,8 +27,6 @@ void mips_restore_state_to_opc(CPUState *cs, const TranslationBlock *tb, const uint64_t *data); -const char *mips_exception_name(int32_t exception); - G_NORETURN void do_raise_exception_err(CPUMIPSState *env, uint32_t exception, int error_code, uintptr_t pc); diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 0fead20d651..528d926d16c 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -742,6 +742,7 @@ static void mips_cpu_class_init(ObjectClass *c, const void *data) &mcc->parent_phases); cc->class_by_name = mips_cpu_class_by_name; + cc->exception_name = mips_exception_name; cc->dump_state = mips_cpu_dump_state; cc->set_pc = mips_cpu_set_pc; cc->get_pc = mips_cpu_get_pc; diff --git a/target/mips/tcg/exception.c b/target/mips/tcg/exception.c index 2f02f9be877..e698def0640 100644 --- a/target/mips/tcg/exception.c +++ b/target/mips/tcg/exception.c @@ -19,7 +19,6 @@ */ #include "qemu/osdep.h" -#include "qemu/log.h" #include "cpu.h" #include "internal.h" #include "exec/helper-proto.h" @@ -129,12 +128,12 @@ static const char * const excp_names[] = { [EXCP_SEMIHOST] = "Semihosting", }; -const char *mips_exception_name(int32_t exception) +const char *mips_exception_name(int excp) { - if (exception < 0 || exception >= ARRAY_SIZE(excp_names)) { + if (excp < 0 || excp >= ARRAY_SIZE(excp_names) || !excp_names[excp]) { return "unknown"; } - return excp_names[exception]; + return excp_names[excp]; } void do_raise_exception_err(CPUMIPSState *env, uint32_t exception, @@ -142,9 +141,6 @@ void do_raise_exception_err(CPUMIPSState *env, uint32_t exception, { CPUState *cs = env_cpu(env); - qemu_log_mask(CPU_LOG_INT, "%s: %d (%s) %d\n", - __func__, exception, mips_exception_name(exception), - error_code); cs->exception_index = exception; env->error_code = error_code; -- 2.55.0
