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(-)
diff --git a/target/i386/arch_dump.c b/target/i386/arch_dump.c
index 16e47c4747d..d5016c198cb 100644
--- a/target/i386/arch_dump.c
+++ b/target/i386/arch_dump.c
@@ -16,6 +16,7 @@
#include "system/dump.h"
#include "elf.h"
#include "system/memory_mapping.h"
+#include "cpu-internal.h"
#define ELF_NOTE_SIZE(hdr_size, name_size, desc_size) \
((DIV_ROUND_UP((hdr_size), 4) \
@@ -394,15 +395,15 @@ int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f,
CPUState *cs,
return cpu_write_qemu_note(f, &cpu->env, s, 0);
}
-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);
+ 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) {
+ return -1;
+ }
+
+ return x86_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 = 5; /* "CORE" or "QEMU" */
diff --git a/target/i386/cpu-internal.h b/target/i386/cpu-internal.h
index 37c61a1bc3d..9407b01d415 100644
--- a/target/i386/cpu-internal.h
+++ b/target/i386/cpu-internal.h
@@ -20,6 +20,8 @@
#ifndef I386_CPU_INTERNAL_H
#define I386_CPU_INTERNAL_H
+#include "system/dump-arch.h"
+
typedef enum FeatureWordType {
CPUID_FEATURE_WORD,
MSR_FEATURE_WORD,
@@ -65,6 +67,9 @@ void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v,
void x86_cpu_apic_create(X86CPU *cpu, Error **errp);
void x86_cpu_apic_realize(X86CPU *cpu, Error **errp);
void x86_cpu_machine_reset_cb(void *opaque);
+
+int x86_get_dump_info(const CPUState *cs, ArchDumpInfo *info,
+ const struct GuestPhysBlockList *guest_phys_blocks);
#endif /* !CONFIG_USER_ONLY */
#endif /* I386_CPU_INTERNAL_H */
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 74eebeabd7a..03efc411ab3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -10919,6 +10919,7 @@ static const struct SysemuCPUOps i386_sysemu_ops = {
.write_elf64_note = x86_cpu_write_elf64_note,
.write_elf32_qemunote = x86_cpu_write_elf32_qemunote,
.write_elf64_qemunote = x86_cpu_write_elf64_qemunote,
+ .get_dump_info = x86_get_dump_info,
#ifdef CONFIG_HMP
.monitor_defs = x86_monitor_defs,
#endif
--
2.43.0