[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/27] cpu: Directly use get_paging_enabled() fallback handler
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 05/27] cpu: Directly use get_paging_enabled() fallback handlers in place |
Date: |
Tue, 2 Mar 2021 15:57:56 +0100 |
No code uses CPUClass::get_paging_enabled() outside of hw/core/cpu.c:
$ git grep -F -- '->get_paging_enabled'
hw/core/cpu.c:74: return cc->get_paging_enabled(cpu);
hw/core/cpu.c:438: k->get_paging_enabled = cpu_common_get_paging_enabled;
target/i386/cpu.c:7418: cc->get_paging_enabled =
x86_cpu_get_paging_enabled;
Check the handler presence in place and remove the common fallback code.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/core/cpu.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index a9ee2c74ec5..1de00bbb474 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu.c
@@ -71,11 +71,10 @@ bool cpu_paging_enabled(const CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
- return cc->get_paging_enabled(cpu);
-}
+ if (cc->get_paging_enabled) {
+ return cc->get_paging_enabled(cpu);
+ }
-static bool cpu_common_get_paging_enabled(const CPUState *cpu)
-{
return false;
}
@@ -420,7 +419,6 @@ static void cpu_class_init(ObjectClass *klass, void *data)
k->parse_features = cpu_common_parse_features;
k->get_arch_id = cpu_common_get_arch_id;
k->has_work = cpu_common_has_work;
- k->get_paging_enabled = cpu_common_get_paging_enabled;
k->get_memory_mapping = cpu_common_get_memory_mapping;
k->gdb_read_register = cpu_common_gdb_read_register;
k->gdb_write_register = cpu_common_gdb_write_register;
--
2.26.2
- [PATCH v3 00/27] cpu: Introduce SysemuCPUOps structure, remove watchpoints from usermode, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 01/27] target: Set CPUClass::vmsd instead of DeviceClass::vmsd, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 02/27] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 03/27] cpu: Introduce cpu_virtio_is_big_endian(), Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 04/27] cpu: Directly use cpu_write_elf*() fallback handlers in place, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 05/27] cpu: Directly use get_paging_enabled() fallback handlers in place,
Philippe Mathieu-Daudé <=
- [PATCH v3 06/27] cpu: Directly use get_memory_mapping() fallback handlers in place, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 07/27] cpu: Introduce SysemuCPUOps structure, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 08/27] cpu: Move CPUClass::vmsd to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 09/27] cpu: Move CPUClass::virtio_is_big_endian to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 10/27] cpu: Move CPUClass::get_crash_info to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 11/27] cpu: Move CPUClass::write_elf* to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 12/27] cpu: Move CPUClass::asidx_from_attrs to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 13/27] cpu: Move CPUClass::get_phys_page_debug to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/02
- [PATCH v3 14/27] cpu: Move CPUClass::get_memory_mapping to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/02