aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-01-23 10:19:44 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-03-06 15:46:18 +0100
commita86cf967a1afe8ccbf58d34983816bc2985d65d2 (patch)
tree2e4ae9211791830a77e75adb0fc1cf5e81167ac1
parente3a575f5609569400da628d384b32f5e3cf58745 (diff)
downloadqemu-a86cf967a1afe8ccbf58d34983816bc2985d65d2.zip
qemu-a86cf967a1afe8ccbf58d34983816bc2985d65d2.tar.gz
qemu-a86cf967a1afe8ccbf58d34983816bc2985d65d2.tar.bz2
cpus: Have cpu_exec_initfn() per user / system emulation
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> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20250123234415.59850-19-philmd@linaro.org>
-rw-r--r--cpu-target.c9
-rw-r--r--hw/core/cpu-system.c7
-rw-r--r--hw/core/cpu-user.c5
3 files changed, 12 insertions, 9 deletions
diff --git a/cpu-target.c b/cpu-target.c
index f4c834f..5aa6c4b 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"
@@ -175,14 +174,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 1310b42..e511507 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"
@@ -187,3 +188,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 e5ccf6b..cdd8de2 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 */
+}