From 01f0738c57063d7efdb682d543e85690db295053 Mon Sep 17 00:00:00 2001 From: Julian Ganz Date: Mon, 27 Oct 2025 11:03:32 +0000 Subject: [PATCH] target/sh4: call plugin trap callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for SuperH targets. Reviewed-by: Richard Henderson Reviewed-by: Yoshinori Sato Signed-off-by: Julian Ganz Message-ID: <20251027110344.2289945-26-alex.bennee@linaro.org> Signed-off-by: Alex Bennée --- target/sh4/helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/sh4/helper.c b/target/sh4/helper.c index 3b18a320b8..5d6295618f 100644 --- a/target/sh4/helper.c +++ b/target/sh4/helper.c @@ -24,6 +24,7 @@ #include "exec/page-protection.h" #include "exec/target_page.h" #include "exec/log.h" +#include "qemu/plugin.h" #if !defined(CONFIG_USER_ONLY) #include "hw/sh4/sh_intc.h" @@ -60,6 +61,7 @@ void superh_cpu_do_interrupt(CPUState *cs) CPUSH4State *env = cpu_env(cs); int do_irq = cpu_test_interrupt(cs, CPU_INTERRUPT_HARD); int do_exp, irq_vector = cs->exception_index; + uint64_t last_pc = env->pc; /* prioritize exceptions over interrupts */ @@ -176,12 +178,14 @@ void superh_cpu_do_interrupt(CPUState *cs) env->pc = env->vbr + 0x100; break; } + qemu_plugin_vcpu_exception_cb(cs, last_pc); return; } if (do_irq) { env->intevt = irq_vector; env->pc = env->vbr + 0x600; + qemu_plugin_vcpu_interrupt_cb(cs, last_pc); return; } }