On 16/10/26 07:43, Philippe Mathieu-Daudé wrote:
On 15/10/26 23:32, Pierrick Bouvier wrote:
For now, we keep the global cpu_get_dump_info symbol defined.

Signed-off-by: Pierrick Bouvier <[email protected]>
---
  target/i386/arch_dump.c    | 17 ++++++++++++++---
  target/i386/cpu-internal.h |  5 +++++
  target/i386/cpu.c          |  1 +
  3 files changed, 20 insertions(+), 3 deletions(-)


-int cpu_get_dump_info(ArchDumpInfo *info,
+int x86_get_dump_info(const CPUState *cs, ArchDumpInfo *info,
                        const GuestPhysBlockList *guest_phys_blocks)
  {
      bool lma = false;
      GuestPhysBlock *block;
  #ifdef TARGET_X86_64
-    X86CPU *first_x86_cpu = X86_CPU(first_cpu);
-    lma = first_cpu && (first_x86_cpu->env.hflags & HF_LMA_MASK);

I know this is pre-existing, but I'd like to understand this check, ...

+    const X86CPU *cpu = X86_CPU(cs);
+    lma = !!(cpu->env.hflags & HF_LMA_MASK);
  #endif
      if (lma) {
@@ -429,6 +430,16 @@ int cpu_get_dump_info(ArchDumpInfo *info,
      return 0;
  }
+int cpu_get_dump_info(ArchDumpInfo *info,
+                      const GuestPhysBlockList *guest_phys_blocks)
+{
+    if (first_cpu == NULL) {

... because you kept it. Why do we need it? QTest something?

(goal is to understand when this can be called on a non-vCPU thread)

Apparently s390x doesn't seem annoyed enough to check for NULL
first_cpu, but maybe that code was never exercised there.

+        return -1;
+    }
+
+    return x86_get_dump_info(first_cpu, info, guest_phys_blocks);
+}




Reply via email to