On 5/19/25 16:19, Julian Ganz wrote:
@@ -10880,6 +10899,7 @@ void arm_cpu_do_interrupt(CPUState *cs)
      ARMCPU *cpu = ARM_CPU(cs);
      CPUARMState *env = &cpu->env;
      unsigned int new_el = env->exception.target_el;
+    uint64_t last_pc = env->pc;

Incorrect.

env->pc is for aarch64 only.
env->regs[15] is for aarch32.

You probably want to use cpu->cc->tcg_ops->get_pc here.
Or export arm_cpu_get_pc from cpu.c so that you can call it directly.

diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c
index 6614719832..bcb4aae0d5 100644
--- a/target/arm/tcg/m_helper.c
+++ b/target/arm/tcg/m_helper.c
@@ -23,6 +23,7 @@
  #if !defined(CONFIG_USER_ONLY)
  #include "hw/intc/armv7m_nvic.h"
  #endif
+#include "qemu/plugin.h"
static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
                           uint32_t reg, uint32_t val)
@@ -2185,6 +2186,7 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
      CPUARMState *env = &cpu->env;
      uint32_t lr;
      bool ignore_stackfaults;
+    uint64_t last_pc = env->pc;

m-profile is always aarch32.

+    switch (cs->exception_index) {
+    case EXCP_IRQ:
+    case EXCP_VIRQ:
+    case EXCP_NMI:
+    case EXCP_VINMI:
+    case EXCP_FIQ:
+    case EXCP_VFIQ:
+    case EXCP_VFNMI:
+    case EXCP_VSERR:
+        qemu_plugin_vcpu_interrupt_cb(cs, last_pc);
+        break;
+    default:
+        qemu_plugin_vcpu_exception_cb(cs, last_pc);
+    }

Share code with a-profile?  Perhaps place the function in internals.h.


r~

Reply via email to