mirror of https://github.com/xemu-project/xemu.git
cpu: Move CPUClass::write_elf* to SysemuCPUOps
The write_elf*() handlers are used to dump vmcore images. This feature is only meaningful for system emulation. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210517105140.1062037-19-f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
83ec01b675
commit
715e3c1afb
|
@ -84,10 +84,10 @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
|
|||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (!cc->write_elf32_qemunote) {
|
||||
if (!cc->sysemu_ops->write_elf32_qemunote) {
|
||||
return 0;
|
||||
}
|
||||
return (*cc->write_elf32_qemunote)(f, cpu, opaque);
|
||||
return (*cc->sysemu_ops->write_elf32_qemunote)(f, cpu, opaque);
|
||||
}
|
||||
|
||||
int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
|
@ -95,10 +95,10 @@ int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
|
|||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (!cc->write_elf32_note) {
|
||||
if (!cc->sysemu_ops->write_elf32_note) {
|
||||
return -1;
|
||||
}
|
||||
return (*cc->write_elf32_note)(f, cpu, cpuid, opaque);
|
||||
return (*cc->sysemu_ops->write_elf32_note)(f, cpu, cpuid, opaque);
|
||||
}
|
||||
|
||||
int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
|
@ -106,10 +106,10 @@ int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
|
|||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (!cc->write_elf64_qemunote) {
|
||||
if (!cc->sysemu_ops->write_elf64_qemunote) {
|
||||
return 0;
|
||||
}
|
||||
return (*cc->write_elf64_qemunote)(f, cpu, opaque);
|
||||
return (*cc->sysemu_ops->write_elf64_qemunote)(f, cpu, opaque);
|
||||
}
|
||||
|
||||
int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
|
@ -117,10 +117,10 @@ int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
|
|||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (!cc->write_elf64_note) {
|
||||
if (!cc->sysemu_ops->write_elf64_note) {
|
||||
return -1;
|
||||
}
|
||||
return (*cc->write_elf64_note)(f, cpu, cpuid, opaque);
|
||||
return (*cc->sysemu_ops->write_elf64_note)(f, cpu, cpuid, opaque);
|
||||
}
|
||||
|
||||
bool cpu_virtio_is_big_endian(CPUState *cpu)
|
||||
|
|
|
@ -113,14 +113,6 @@ struct SysemuCPUOps;
|
|||
* a memory access with the specified memory transaction attributes.
|
||||
* @gdb_read_register: Callback for letting GDB read a register.
|
||||
* @gdb_write_register: Callback for letting GDB write a register.
|
||||
* @write_elf64_note: Callback for writing a CPU-specific ELF note to a
|
||||
* 64-bit VM coredump.
|
||||
* @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
|
||||
* note to a 32-bit VM coredump.
|
||||
* @write_elf32_note: Callback for writing a CPU-specific ELF note to a
|
||||
* 32-bit VM coredump.
|
||||
* @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
|
||||
* note to a 32-bit VM coredump.
|
||||
* @gdb_num_core_regs: Number of core registers accessible to GDB.
|
||||
* @gdb_core_xml_file: File name for core registers GDB XML description.
|
||||
* @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
|
||||
|
@ -164,15 +156,6 @@ struct CPUClass {
|
|||
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
|
||||
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
|
||||
|
||||
int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
int cpuid, void *opaque);
|
||||
int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
void *opaque);
|
||||
int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
int cpuid, void *opaque);
|
||||
int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
void *opaque);
|
||||
|
||||
const char *gdb_core_xml_file;
|
||||
gchar * (*gdb_arch_name)(CPUState *cpu);
|
||||
const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
|
||||
|
|
|
@ -21,6 +21,30 @@ typedef struct SysemuCPUOps {
|
|||
* GUEST_PANICKED events.
|
||||
*/
|
||||
GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
|
||||
/**
|
||||
* @write_elf32_note: Callback for writing a CPU-specific ELF note to a
|
||||
* 32-bit VM coredump.
|
||||
*/
|
||||
int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
int cpuid, void *opaque);
|
||||
/**
|
||||
* @write_elf64_note: Callback for writing a CPU-specific ELF note to a
|
||||
* 64-bit VM coredump.
|
||||
*/
|
||||
int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
int cpuid, void *opaque);
|
||||
/**
|
||||
* @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
|
||||
* note to a 32-bit VM coredump.
|
||||
*/
|
||||
int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
void *opaque);
|
||||
/**
|
||||
* @write_elf64_qemunote: Callback for writing a CPU- and QEMU-specific ELF
|
||||
* note to a 64-bit VM coredump.
|
||||
*/
|
||||
int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
|
||||
void *opaque);
|
||||
/**
|
||||
* @virtio_is_big_endian: Callback to return %true if a CPU which supports
|
||||
* runtime configurable endianness is currently big-endian.
|
||||
|
|
|
@ -1948,6 +1948,8 @@ static gchar *arm_gdb_arch_name(CPUState *cs)
|
|||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps arm_sysemu_ops = {
|
||||
.write_elf32_note = arm_cpu_write_elf32_note,
|
||||
.write_elf64_note = arm_cpu_write_elf64_note,
|
||||
.virtio_is_big_endian = arm_cpu_virtio_is_big_endian,
|
||||
.legacy_vmsd = &vmstate_arm_cpu,
|
||||
};
|
||||
|
@ -1992,8 +1994,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
|
|||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
|
||||
cc->asidx_from_attrs = arm_asidx_from_attrs;
|
||||
cc->write_elf64_note = arm_cpu_write_elf64_note;
|
||||
cc->write_elf32_note = arm_cpu_write_elf32_note;
|
||||
cc->sysemu_ops = &arm_sysemu_ops;
|
||||
#endif
|
||||
cc->gdb_num_core_regs = 26;
|
||||
|
|
|
@ -6719,6 +6719,10 @@ static Property x86_cpu_properties[] = {
|
|||
|
||||
static const struct SysemuCPUOps i386_sysemu_ops = {
|
||||
.get_crash_info = x86_cpu_get_crash_info,
|
||||
.write_elf32_note = x86_cpu_write_elf32_note,
|
||||
.write_elf64_note = x86_cpu_write_elf64_note,
|
||||
.write_elf32_qemunote = x86_cpu_write_elf32_qemunote,
|
||||
.write_elf64_qemunote = x86_cpu_write_elf64_qemunote,
|
||||
.legacy_vmsd = &vmstate_x86_cpu,
|
||||
};
|
||||
#endif
|
||||
|
@ -6753,10 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
|
|||
cc->asidx_from_attrs = x86_asidx_from_attrs;
|
||||
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
|
||||
cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug;
|
||||
cc->write_elf64_note = x86_cpu_write_elf64_note;
|
||||
cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote;
|
||||
cc->write_elf32_note = x86_cpu_write_elf32_note;
|
||||
cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote;
|
||||
cc->sysemu_ops = &i386_sysemu_ops;
|
||||
#endif /* !CONFIG_USER_ONLY */
|
||||
|
||||
|
|
|
@ -9267,6 +9267,8 @@ static Property ppc_cpu_properties[] = {
|
|||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps ppc_sysemu_ops = {
|
||||
.write_elf32_note = ppc32_cpu_write_elf32_note,
|
||||
.write_elf64_note = ppc64_cpu_write_elf64_note,
|
||||
.virtio_is_big_endian = ppc_cpu_is_big_endian,
|
||||
.legacy_vmsd = &vmstate_ppc_cpu,
|
||||
};
|
||||
|
@ -9316,10 +9318,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
|
|||
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &ppc_sysemu_ops;
|
||||
#endif
|
||||
#if defined(CONFIG_SOFTMMU)
|
||||
cc->write_elf64_note = ppc64_cpu_write_elf64_note;
|
||||
cc->write_elf32_note = ppc32_cpu_write_elf32_note;
|
||||
#endif
|
||||
|
||||
cc->gdb_num_core_regs = 71;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
|
|
|
@ -600,6 +600,8 @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
|
|||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps riscv_sysemu_ops = {
|
||||
.write_elf64_note = riscv_cpu_write_elf64_note,
|
||||
.write_elf32_note = riscv_cpu_write_elf32_note,
|
||||
.legacy_vmsd = &vmstate_riscv_cpu,
|
||||
};
|
||||
#endif
|
||||
|
@ -647,8 +649,6 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
|
|||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &riscv_sysemu_ops;
|
||||
cc->write_elf64_note = riscv_cpu_write_elf64_note;
|
||||
cc->write_elf32_note = riscv_cpu_write_elf32_note;
|
||||
#endif
|
||||
cc->gdb_arch_name = riscv_gdb_arch_name;
|
||||
cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml;
|
||||
|
|
|
@ -481,6 +481,7 @@ static void s390_cpu_reset_full(DeviceState *dev)
|
|||
|
||||
static const struct SysemuCPUOps s390_sysemu_ops = {
|
||||
.get_crash_info = s390_cpu_get_crash_info,
|
||||
.write_elf64_note = s390_cpu_write_elf64_note,
|
||||
.legacy_vmsd = &vmstate_s390_cpu,
|
||||
};
|
||||
#endif
|
||||
|
@ -525,7 +526,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
|
|||
cc->gdb_write_register = s390_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = s390_cpu_get_phys_page_debug;
|
||||
cc->write_elf64_note = s390_cpu_write_elf64_note;
|
||||
cc->sysemu_ops = &s390_sysemu_ops;
|
||||
#endif
|
||||
cc->disas_set_info = s390_cpu_disas_set_info;
|
||||
|
|
Loading…
Reference in New Issue