On Fri, 05 Sep 2025 05:46:54 +0900,
Julian Ganz wrote:
>
> 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 Renesas Xtreme targets.
>
Reviewed-by: Yoshinori Sato <[email protected]>
> Reviewed-by: Richard Henderson <[email protected]>
> Signed-off-by: Julian Ganz <[email protected]>
> ---
> target/rx/helper.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/target/rx/helper.c b/target/rx/helper.c
> index ce003af421..054bfdff57 100644
> --- a/target/rx/helper.c
> +++ b/target/rx/helper.c
> @@ -22,6 +22,7 @@
> #include "exec/log.h"
> #include "accel/tcg/cpu-ldst.h"
> #include "hw/irq.h"
> +#include "qemu/plugin.h"
>
> void rx_cpu_unpack_psw(CPURXState *env, uint32_t psw, int rte)
> {
> @@ -46,6 +47,7 @@ void rx_cpu_do_interrupt(CPUState *cs)
> CPURXState *env = cpu_env(cs);
> int do_irq = cpu_test_interrupt(cs, INT_FLAGS);
> uint32_t save_psw;
> + uint64_t last_pc = env->pc;
>
> env->in_sleep = 0;
>
> @@ -65,6 +67,7 @@ void rx_cpu_do_interrupt(CPUState *cs)
> env->psw_ipl = 15;
> cs->interrupt_request &= ~CPU_INTERRUPT_FIR;
> qemu_set_irq(env->ack, env->ack_irq);
> + qemu_plugin_vcpu_interrupt_cb(cs, last_pc);
> qemu_log_mask(CPU_LOG_INT, "fast interrupt raised\n");
> } else if (do_irq & CPU_INTERRUPT_HARD) {
> env->isp -= 4;
> @@ -75,6 +78,7 @@ void rx_cpu_do_interrupt(CPUState *cs)
> env->psw_ipl = env->ack_ipl;
> cs->interrupt_request &= ~CPU_INTERRUPT_HARD;
> qemu_set_irq(env->ack, env->ack_irq);
> + qemu_plugin_vcpu_interrupt_cb(cs, last_pc);
> qemu_log_mask(CPU_LOG_INT,
> "interrupt 0x%02x raised\n", env->ack_irq);
> }
> @@ -92,6 +96,14 @@ void rx_cpu_do_interrupt(CPUState *cs)
> } else {
> env->pc = cpu_ldl_data(env, env->intb + (vec & 0xff) * 4);
> }
> +
> + if (vec == 30) {
> + /* Non-maskable interrupt */
> + qemu_plugin_vcpu_interrupt_cb(cs, last_pc);
> + } else {
> + qemu_plugin_vcpu_exception_cb(cs, last_pc);
> + }
> +
> switch (vec) {
> case 20:
> expname = "privilege violation";
> --
> 2.49.1
>