[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 18/20] cpus: Have cpu_exec_initfn() per user / system emulation
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 18/20] cpus: Have cpu_exec_initfn() per user / system emulation |
Date: |
Fri, 24 Jan 2025 00:44:12 +0100 |
Slighly simplify cpu-target.c again by extracting cpu_exec_initfn()
to cpu-{system,user}.c, adding an empty stub for user emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Good enough for now...
---
cpu-target.c | 9 ---------
hw/core/cpu-system.c | 7 +++++++
hw/core/cpu-user.c | 5 +++++
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/cpu-target.c b/cpu-target.c
index dff8c0747f9..3d33d20b8c8 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -24,7 +24,6 @@
#include "migration/vmstate.h"
#ifndef CONFIG_USER_ONLY
#include "hw/core/sysemu-cpu-ops.h"
-#include "exec/address-spaces.h"
#endif
#include "system/accel-ops.h"
#include "system/cpus.h"
@@ -176,14 +175,6 @@ void cpu_exec_unrealizefn(CPUState *cpu)
accel_cpu_common_unrealize(cpu);
}
-void cpu_exec_initfn(CPUState *cpu)
-{
-#ifndef CONFIG_USER_ONLY
- cpu->memory = get_system_memory();
- object_ref(OBJECT(cpu->memory));
-#endif
-}
-
char *cpu_model_from_type(const char *typename)
{
const char *suffix = "-" CPU_RESOLVING_TYPE;
diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
index c63c984a803..0520c362db4 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "exec/address-spaces.h"
#include "exec/memory.h"
#include "exec/tswap.h"
#include "hw/qdev-core.h"
@@ -182,3 +183,9 @@ void cpu_class_init_props(DeviceClass *dc)
device_class_set_props(dc, cpu_system_props);
}
+
+void cpu_exec_initfn(CPUState *cpu)
+{
+ cpu->memory = get_system_memory();
+ object_ref(OBJECT(cpu->memory));
+}
diff --git a/hw/core/cpu-user.c b/hw/core/cpu-user.c
index e5ccf6bf13a..cdd8de2fefa 100644
--- a/hw/core/cpu-user.c
+++ b/hw/core/cpu-user.c
@@ -25,3 +25,8 @@ void cpu_class_init_props(DeviceClass *dc)
{
device_class_set_props(dc, cpu_user_props);
}
+
+void cpu_exec_initfn(CPUState *cpu)
+{
+ /* nothing to do */
+}
--
2.47.1
- [PATCH 13/20] accel: Forward-declare AccelOpsClass in 'qemu/typedefs.h', (continued)
- [PATCH 13/20] accel: Forward-declare AccelOpsClass in 'qemu/typedefs.h', Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 14/20] accel/tcg: Move cpu_memory_rw_debug() user implementation to user-exec.c, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 15/20] cpus: Fix style in cpu-target.c, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 16/20] cpus: Restrict cpu_common_post_load() code to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 17/20] cpus: Have cpu_class_init_props() per user / system emulation, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 18/20] cpus: Have cpu_exec_initfn() per user / system emulation,
Philippe Mathieu-Daudé <=
- [PATCH 19/20] cpus: Register VMState per user / system emulation, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 20/20] cpus: Build cpu_exec_[un]realizefn() methods once, Philippe Mathieu-Daudé, 2025/01/23