target-arm: Minimalistic CPU QOM'ification
Introduce only one non-abstract type TYPE_ARM_CPU and do not touch
cp15 registers to not interfere with Peter's ongoing remodelling.
Embed CPUARMState as first (additional) field of ARMCPU.
Let CPUClass::reset() call cpu_state_reset() for now.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 1ce8105..dd8e306 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -278,6 +278,10 @@
}
}
+/* TODO Move contents into arm_cpu_reset() in cpu.c,
+ * once cpu_reset_model_id() is eliminated,
+ * and then forward to cpu_reset() here.
+ */
void cpu_state_reset(CPUARMState *env)
{
uint32_t id;
@@ -400,6 +404,7 @@
CPUARMState *cpu_arm_init(const char *cpu_model)
{
+ ARMCPU *cpu;
CPUARMState *env;
uint32_t id;
static int inited = 0;
@@ -407,7 +412,8 @@
id = cpu_arm_find_by_name(cpu_model);
if (id == 0)
return NULL;
- env = g_malloc0(sizeof(CPUARMState));
+ cpu = ARM_CPU(object_new(TYPE_ARM_CPU));
+ env = &cpu->env;
cpu_exec_init(env);
if (tcg_enabled() && !inited) {
inited = 1;