For now, we keep the global cpu_get_dump_info symbol defined.

Signed-off-by: Pierrick Bouvier <[email protected]>
---
 target/ppc/arch_dump.c | 28 +++++++++++++++++++---------
 target/ppc/cpu_init.c  |  1 +
 target/ppc/internal.h  |  4 ++++
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c
index 80ac6c3e320..69613ce82a8 100644
--- a/target/ppc/arch_dump.c
+++ b/target/ppc/arch_dump.c
@@ -17,6 +17,8 @@
 #include "elf.h"
 #include "system/dump.h"
 #include "system/kvm.h"
+#include "internal.h"
+#include "hw/core/dump-cpu-ops.h"
 
 #ifdef TARGET_PPC64
 #define ELFCLASS ELFCLASS64
@@ -229,16 +231,10 @@ static const struct NoteFuncDescStruct {
 
 typedef struct NoteFuncDescStruct NoteFuncDesc;
 
-int cpu_get_dump_info(ArchDumpInfo *info,
-                      const struct GuestPhysBlockList *guest_phys_blocks)
+static int ppc_get_dump_info(const CPUState *cs, ArchDumpInfo *info,
+                             const struct GuestPhysBlockList 
*guest_phys_blocks)
 {
-    PowerPCCPU *cpu;
-
-    if (first_cpu == NULL) {
-        return -1;
-    }
-
-    cpu = POWERPC_CPU(first_cpu);
+    const PowerPCCPU *cpu = POWERPC_CPU(cs);
 
     info->d_machine = PPC_ELF_MACHINE;
     info->d_class = ELFCLASS;
@@ -257,6 +253,20 @@ int cpu_get_dump_info(ArchDumpInfo *info,
     return 0;
 }
 
+const DumpCPUOps ppc_dump_ops = {
+    .get_dump_info = ppc_get_dump_info,
+};
+
+int cpu_get_dump_info(ArchDumpInfo *info,
+                      const struct GuestPhysBlockList *guest_phys_blocks)
+{
+    if (first_cpu == NULL) {
+        return -1;
+    }
+
+    return ppc_get_dump_info(first_cpu, info, guest_phys_blocks);
+}
+
 ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
 {
     int name_size = 8; /* "CORE" or "QEMU" rounded */
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index b711f9c0a85..53bb5f1bc52 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -7537,6 +7537,7 @@ static void ppc_cpu_class_init(ObjectClass *oc, const 
void *data)
     cc->gdb_write_register = ppc_cpu_gdb_write_register;
 #ifndef CONFIG_USER_ONLY
     cc->sysemu_ops = &ppc_sysemu_ops;
+    cc->dump_ops = &ppc_dump_ops;
     INTERRUPT_STATS_PROVIDER_CLASS(oc)->get_statistics = ppc_get_irq_stats;
 
     /* check_prot_access_type relies on MMU access and PAGE bits relations */
diff --git a/target/ppc/internal.h b/target/ppc/internal.h
index a20a0f9f7e0..c890a596085 100644
--- a/target/ppc/internal.h
+++ b/target/ppc/internal.h
@@ -324,4 +324,8 @@ static inline int ger_pack_masks(int pmsk, int ymsk, int 
xmsk)
 TCGTBCPUState ppc_get_tb_cpu_state(CPUState *cs);
 #endif
 
+#ifndef CONFIG_USER_ONLY
+extern const struct DumpCPUOps ppc_dump_ops;
+#endif
+
 #endif /* PPC_INTERNAL_H */
-- 
2.43.0


Reply via email to