On 5/19/25 16:19, 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 Power PC targets.

Signed-off-by: Julian Ganz <neither@nut.email>
---
  target/ppc/excp_helper.c | 42 ++++++++++++++++++++++++++++++++++++++++
  1 file changed, 42 insertions(+)

diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index 1efdc4066e..24740a000b 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -27,6 +27,7 @@
  #include "internal.h"
  #include "helper_regs.h"
  #include "hw/ppc/ppc.h"
+#include "qemu/plugin.h"
#include "trace.h" @@ -404,11 +405,32 @@ static void powerpc_mcheck_checkstop(CPUPPCState *env)
      powerpc_checkstop(env, "machine check with MSR[ME]=0");
  }
+static void powerpc_do_plugin_vcpu_interrupt_cb(CPUState *cs, int excp,
+                                                uint64_t from)
+{
+    switch (excp) {
+    case POWERPC_EXCP_NONE:
+        break;
+    case POWERPC_EXCP_FIT:
+    case POWERPC_EXCP_WDT:
+    case POWERPC_EXCP_DEBUG:

I think DEBUG is an exception.  It's synchronous.

@@ -758,6 +787,7 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp)
          if (lev == 1 && cpu->vhyp) {
              cpu->vhyp_class->hypercall(cpu->vhyp, cpu);
              powerpc_reset_excp_state(cpu);
+            qemu_plugin_vcpu_hostcall_cb(env_cpu(env), last_pc);

Err... I think you need to be more specific about what you mean by "hostcall". Certainly this isn't the same thing as semihosting.


r~

Reply via email to