[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/16] cpu: Move CPUClass::get_memory_mapping to CPUSystemOperati
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 14/16] cpu: Move CPUClass::get_memory_mapping to CPUSystemOperations |
Date: |
Fri, 26 Feb 2021 17:32:25 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/core/cpu.h | 8 +++++---
hw/core/cpu.c | 4 ++--
target/i386/cpu.c | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 5bc66653c19..caca5896592 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -84,6 +84,11 @@ struct AccelCPUClass;
* struct CPUSystemOperations: System operations specific to a CPU class
*/
typedef struct CPUSystemOperations {
+ /**
+ * @get_memory_mapping: Callback for obtaining the memory mappings.
+ */
+ void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
+ Error **errp);
/**
* @get_phys_page_debug: Callback for obtaining a physical address.
*/
@@ -157,7 +162,6 @@ typedef struct CPUSystemOperations {
* @dump_statistics: Callback for dumping statistics.
* @get_arch_id: Callback for getting architecture-dependent CPU ID.
* @get_paging_enabled: Callback for inquiring whether paging is enabled.
- * @get_memory_mapping: Callback for obtaining the memory mappings.
* @set_pc: Callback for setting the Program Counter register. This
* should have the semantics used by the target architecture when
* setting the PC from a source such as an ELF file entry point;
@@ -201,8 +205,6 @@ struct CPUClass {
void (*dump_statistics)(CPUState *cpu, int flags);
int64_t (*get_arch_id)(CPUState *cpu);
bool (*get_paging_enabled)(const CPUState *cpu);
- void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
- Error **errp);
void (*set_pc)(CPUState *cpu, vaddr value);
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index f0c558c002e..606fc753bf0 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu.c
@@ -83,8 +83,8 @@ void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList
*list,
{
CPUClass *cc = CPU_GET_CLASS(cpu);
- if (cc->get_memory_mapping) {
- cc->get_memory_mapping(cpu, list, errp);
+ if (cc->system_ops.get_memory_mapping) {
+ cc->system_ops.get_memory_mapping(cpu, list, errp);
return;
}
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index f6f5c333b7e..92691a22de5 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -7419,7 +7419,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc,
void *data)
#ifndef CONFIG_USER_ONLY
cc->system_ops.asidx_from_attrs = x86_asidx_from_attrs;
- cc->get_memory_mapping = x86_cpu_get_memory_mapping;
+ cc->system_ops.get_memory_mapping = x86_cpu_get_memory_mapping;
cc->system_ops.get_phys_page_attrs_debug =
x86_cpu_get_phys_page_attrs_debug;
cc->system_ops.get_crash_info = x86_cpu_get_crash_info;
cc->system_ops.write_elf64_note = x86_cpu_write_elf64_note;
--
2.26.2
- [PATCH 06/16] cpu: Directly use get_memory_mapping() fallback handlers in place, (continued)
- [PATCH 06/16] cpu: Directly use get_memory_mapping() fallback handlers in place, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 08/16] cpu: Move CPUClass::vmsd to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 07/16] cpu: Introduce CPUSystemOperations structure, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 11/16] cpu: Move CPUClass::write_elf* to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 09/16] cpu: Move CPUClass::virtio_is_big_endian to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 10/16] cpu: Move CPUClass::get_crash_info to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 13/16] cpu: Move CPUClass::get_phys_page_debug to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 12/16] cpu: Move CPUClass::asidx_from_attrs to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 14/16] cpu: Move CPUClass::get_memory_mapping to CPUSystemOperations,
Philippe Mathieu-Daudé <=
- [PATCH 15/16] cpu: Move CPUClass::get_paging_enabled to CPUSystemOperations, Philippe Mathieu-Daudé, 2021/02/26
- [PATCH 16/16] cpu: Restrict cpu_paging_enabled / cpu_get_memory_mapping to sysemu, Philippe Mathieu-Daudé, 2021/02/26