cpu: Move CPUClass::get_phys_page_debug to SysemuCPUOps
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210517105140.1062037-21-f4bug@amsat.org> [rth: Drop declaration movement from target/*/cpu.h] Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
faf39e8283
commit
08928c6d0d
@ -52,12 +52,12 @@ hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
|
||||
{
|
||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||
|
||||
if (cc->get_phys_page_attrs_debug) {
|
||||
return cc->get_phys_page_attrs_debug(cpu, addr, attrs);
|
||||
if (cc->sysemu_ops->get_phys_page_attrs_debug) {
|
||||
return cc->sysemu_ops->get_phys_page_attrs_debug(cpu, addr, attrs);
|
||||
}
|
||||
/* Fallback for CPUs which don't implement the _attrs_ hook */
|
||||
*attrs = MEMTXATTRS_UNSPECIFIED;
|
||||
return cc->get_phys_page_debug(cpu, addr);
|
||||
return cc->sysemu_ops->get_phys_page_debug(cpu, addr);
|
||||
}
|
||||
|
||||
hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
|
||||
|
@ -104,11 +104,6 @@ struct SysemuCPUOps;
|
||||
* If the target behaviour here is anything other than "set
|
||||
* the PC register to the value passed in" then the target must
|
||||
* also implement the synchronize_from_tb hook.
|
||||
* @get_phys_page_debug: Callback for obtaining a physical address.
|
||||
* @get_phys_page_attrs_debug: Callback for obtaining a physical address and the
|
||||
* associated memory transaction attributes to use for the access.
|
||||
* CPUs which use memory transaction attributes should implement this
|
||||
* instead of get_phys_page_debug.
|
||||
* @gdb_read_register: Callback for letting GDB read a register.
|
||||
* @gdb_write_register: Callback for letting GDB write a register.
|
||||
* @gdb_num_core_regs: Number of core registers accessible to GDB.
|
||||
@ -147,9 +142,6 @@ struct CPUClass {
|
||||
void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
|
||||
Error **errp);
|
||||
void (*set_pc)(CPUState *cpu, vaddr value);
|
||||
hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
|
||||
hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
|
||||
MemTxAttrs *attrs);
|
||||
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
|
||||
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
|
||||
|
||||
|
@ -16,6 +16,19 @@
|
||||
* struct SysemuCPUOps: System operations specific to a CPU class
|
||||
*/
|
||||
typedef struct SysemuCPUOps {
|
||||
/**
|
||||
* @get_phys_page_debug: Callback for obtaining a physical address.
|
||||
*/
|
||||
hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
|
||||
/**
|
||||
* @get_phys_page_attrs_debug: Callback for obtaining a physical address
|
||||
* and the associated memory transaction attributes to use for the
|
||||
* access.
|
||||
* CPUs which use memory transaction attributes should implement this
|
||||
* instead of get_phys_page_debug.
|
||||
*/
|
||||
hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
|
||||
MemTxAttrs *attrs);
|
||||
/**
|
||||
* @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
|
||||
* a memory access with the specified memory transaction attributes.
|
||||
|
@ -210,6 +210,7 @@ static void alpha_cpu_initfn(Object *obj)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps alpha_sysemu_ops = {
|
||||
.get_phys_page_debug = alpha_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -243,7 +244,6 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = alpha_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = alpha_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vmstate_alpha_cpu;
|
||||
cc->sysemu_ops = &alpha_sysemu_ops;
|
||||
#endif
|
||||
|
@ -1948,6 +1948,7 @@ static gchar *arm_gdb_arch_name(CPUState *cs)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps arm_sysemu_ops = {
|
||||
.get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug,
|
||||
.asidx_from_attrs = arm_asidx_from_attrs,
|
||||
.write_elf32_note = arm_cpu_write_elf32_note,
|
||||
.write_elf64_note = arm_cpu_write_elf64_note,
|
||||
@ -1993,7 +1994,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = arm_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = arm_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
|
||||
cc->sysemu_ops = &arm_sysemu_ops;
|
||||
#endif
|
||||
cc->gdb_num_core_regs = 26;
|
||||
|
@ -187,6 +187,7 @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps avr_sysemu_ops = {
|
||||
.get_phys_page_debug = avr_cpu_get_phys_page_debug,
|
||||
};
|
||||
|
||||
#include "hw/core/tcg-cpu-ops.h"
|
||||
@ -217,7 +218,6 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->dump_state = avr_cpu_dump_state;
|
||||
cc->set_pc = avr_cpu_set_pc;
|
||||
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
|
||||
cc->get_phys_page_debug = avr_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vms_avr_cpu;
|
||||
cc->sysemu_ops = &avr_sysemu_ops;
|
||||
cc->disas_set_info = avr_cpu_disas_set_info;
|
||||
|
@ -197,6 +197,7 @@ static void cris_cpu_initfn(Object *obj)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps cris_sysemu_ops = {
|
||||
.get_phys_page_debug = cris_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -299,7 +300,6 @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = cris_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = cris_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = cris_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vmstate_cris_cpu;
|
||||
cc->sysemu_ops = &cris_sysemu_ops;
|
||||
#endif
|
||||
|
@ -135,6 +135,7 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps hppa_sysemu_ops = {
|
||||
.get_phys_page_debug = hppa_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -168,7 +169,6 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = hppa_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = hppa_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vmstate_hppa_cpu;
|
||||
cc->sysemu_ops = &hppa_sysemu_ops;
|
||||
#endif
|
||||
|
@ -6718,6 +6718,7 @@ static Property x86_cpu_properties[] = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps i386_sysemu_ops = {
|
||||
.get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug,
|
||||
.asidx_from_attrs = x86_asidx_from_attrs,
|
||||
.get_crash_info = x86_cpu_get_crash_info,
|
||||
.write_elf32_note = x86_cpu_write_elf32_note,
|
||||
@ -6756,7 +6757,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
|
||||
cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug;
|
||||
cc->sysemu_ops = &i386_sysemu_ops;
|
||||
#endif /* !CONFIG_USER_ONLY */
|
||||
|
||||
|
@ -507,6 +507,7 @@ static const VMStateDescription vmstate_m68k_cpu = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps m68k_sysemu_ops = {
|
||||
.get_phys_page_debug = m68k_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -540,7 +541,6 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
|
||||
cc->gdb_read_register = m68k_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = m68k_cpu_gdb_write_register;
|
||||
#if defined(CONFIG_SOFTMMU)
|
||||
cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vmstate_m68k_cpu;
|
||||
cc->sysemu_ops = &m68k_sysemu_ops;
|
||||
#endif
|
||||
|
@ -356,6 +356,7 @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps mb_sysemu_ops = {
|
||||
.get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -393,7 +394,6 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_write_register = mb_cpu_gdb_write_register;
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug;
|
||||
dc->vmsd = &vmstate_mb_cpu;
|
||||
cc->sysemu_ops = &mb_sysemu_ops;
|
||||
#endif
|
||||
|
@ -525,6 +525,7 @@ static Property mips_cpu_properties[] = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps mips_sysemu_ops = {
|
||||
.get_phys_page_debug = mips_cpu_get_phys_page_debug,
|
||||
.legacy_vmsd = &vmstate_mips_cpu,
|
||||
};
|
||||
#endif
|
||||
@ -568,7 +569,6 @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
|
||||
cc->gdb_read_register = mips_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = mips_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &mips_sysemu_ops;
|
||||
#endif
|
||||
cc->disas_set_info = mips_cpu_disas_set_info;
|
||||
|
@ -211,6 +211,7 @@ static Property nios2_properties[] = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps nios2_sysemu_ops = {
|
||||
.get_phys_page_debug = nios2_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -244,7 +245,6 @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->set_pc = nios2_cpu_set_pc;
|
||||
cc->disas_set_info = nios2_cpu_disas_set_info;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &nios2_sysemu_ops;
|
||||
#endif
|
||||
cc->gdb_read_register = nios2_cpu_gdb_read_register;
|
||||
|
@ -178,6 +178,7 @@ static void openrisc_any_initfn(Object *obj)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps openrisc_sysemu_ops = {
|
||||
.get_phys_page_debug = openrisc_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -210,7 +211,6 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = openrisc_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = openrisc_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vmstate_openrisc_cpu;
|
||||
cc->sysemu_ops = &openrisc_sysemu_ops;
|
||||
#endif
|
||||
|
@ -9267,6 +9267,7 @@ static Property ppc_cpu_properties[] = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps ppc_sysemu_ops = {
|
||||
.get_phys_page_debug = ppc_cpu_get_phys_page_debug,
|
||||
.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,
|
||||
@ -9315,7 +9316,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = ppc_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = ppc_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &ppc_sysemu_ops;
|
||||
#endif
|
||||
|
||||
|
@ -600,6 +600,7 @@ 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 = {
|
||||
.get_phys_page_debug = riscv_cpu_get_phys_page_debug,
|
||||
.write_elf64_note = riscv_cpu_write_elf64_note,
|
||||
.write_elf32_note = riscv_cpu_write_elf32_note,
|
||||
.legacy_vmsd = &vmstate_riscv_cpu,
|
||||
@ -647,7 +648,6 @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
|
||||
cc->gdb_stop_before_watchpoint = true;
|
||||
cc->disas_set_info = riscv_cpu_disas_set_info;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &riscv_sysemu_ops;
|
||||
#endif
|
||||
cc->gdb_arch_name = riscv_gdb_arch_name;
|
||||
|
@ -177,6 +177,7 @@ static void rx_cpu_init(Object *obj)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps rx_sysemu_ops = {
|
||||
.get_phys_page_debug = rx_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -214,7 +215,6 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
|
||||
#endif
|
||||
cc->gdb_read_register = rx_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = rx_cpu_gdb_write_register;
|
||||
cc->get_phys_page_debug = rx_cpu_get_phys_page_debug;
|
||||
cc->disas_set_info = rx_cpu_disas_set_info;
|
||||
|
||||
cc->gdb_num_core_regs = 26;
|
||||
|
@ -480,6 +480,7 @@ static void s390_cpu_reset_full(DeviceState *dev)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps s390_sysemu_ops = {
|
||||
.get_phys_page_debug = s390_cpu_get_phys_page_debug,
|
||||
.get_crash_info = s390_cpu_get_crash_info,
|
||||
.write_elf64_note = s390_cpu_write_elf64_note,
|
||||
.legacy_vmsd = &vmstate_s390_cpu,
|
||||
@ -525,7 +526,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = s390_cpu_gdb_read_register;
|
||||
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->sysemu_ops = &s390_sysemu_ops;
|
||||
#endif
|
||||
cc->disas_set_info = s390_cpu_disas_set_info;
|
||||
|
@ -227,6 +227,7 @@ static const VMStateDescription vmstate_sh_cpu = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps sh4_sysemu_ops = {
|
||||
.get_phys_page_debug = superh_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -263,7 +264,6 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = superh_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = superh_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &sh4_sysemu_ops;
|
||||
dc->vmsd = &vmstate_sh_cpu;
|
||||
#endif
|
||||
|
@ -852,6 +852,7 @@ static Property sparc_cpu_properties[] = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps sparc_sysemu_ops = {
|
||||
.get_phys_page_debug = sparc_cpu_get_phys_page_debug,
|
||||
.legacy_vmsd = &vmstate_sparc_cpu,
|
||||
};
|
||||
#endif
|
||||
@ -896,7 +897,6 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_read_register = sparc_cpu_gdb_read_register;
|
||||
cc->gdb_write_register = sparc_cpu_gdb_write_register;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &sparc_sysemu_ops;
|
||||
#endif
|
||||
cc->disas_set_info = cpu_sparc_disas_set_info;
|
||||
|
@ -145,6 +145,7 @@ static void tc27x_initfn(Object *obj)
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps tricore_sysemu_ops = {
|
||||
.get_phys_page_debug = tricore_cpu_get_phys_page_debug,
|
||||
};
|
||||
|
||||
#include "hw/core/tcg-cpu-ops.h"
|
||||
@ -175,7 +176,6 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
|
||||
|
||||
cc->dump_state = tricore_cpu_dump_state;
|
||||
cc->set_pc = tricore_cpu_set_pc;
|
||||
cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
|
||||
cc->sysemu_ops = &tricore_sysemu_ops;
|
||||
cc->tcg_ops = &tricore_tcg_ops;
|
||||
}
|
||||
|
@ -184,6 +184,7 @@ static const VMStateDescription vmstate_xtensa_cpu = {
|
||||
#include "hw/core/sysemu-cpu-ops.h"
|
||||
|
||||
static const struct SysemuCPUOps xtensa_sysemu_ops = {
|
||||
.get_phys_page_debug = xtensa_cpu_get_phys_page_debug,
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -222,7 +223,6 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
|
||||
cc->gdb_stop_before_watchpoint = true;
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
cc->sysemu_ops = &xtensa_sysemu_ops;
|
||||
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
|
||||
dc->vmsd = &vmstate_xtensa_cpu;
|
||||
#endif
|
||||
cc->disas_set_info = xtensa_cpu_disas_set_info;
|
||||
|
Loading…
Reference in New Issue
Block a user