aboutsummaryrefslogtreecommitdiff
path: root/target-lm32/cpu.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-01-16 03:31:27 +0100
committerAndreas Färber <afaerber@suse.de>2013-02-16 14:50:57 +0100
commit9c23169e8cd54b490d55221b6498d42966f964f3 (patch)
tree9b042a27c4493c73b92c8a858d1630743728856f /target-lm32/cpu.c
parentca45f8b0440358ccca63446cf0df05772791b2a1 (diff)
target-lm32: Introduce QOM realizefn for LM32CPU
Introduce a realizefn and set realized = true in cpu_lm32_init(). Also move cpu_reset() call from initfn to realizefn. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-lm32/cpu.c')
-rw-r--r--target-lm32/cpu.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c
index eca2dca427..6a84f51bf9 100644
--- a/target-lm32/cpu.c
+++ b/target-lm32/cpu.c
@@ -42,6 +42,18 @@ static void lm32_cpu_reset(CPUState *s)
memset(env, 0, offsetof(CPULM32State, breakpoints));
}
+static void lm32_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+ LM32CPU *cpu = LM32_CPU(dev);
+ LM32CPUClass *lcc = LM32_CPU_GET_CLASS(dev);
+
+ cpu_reset(CPU(cpu));
+
+ qemu_init_vcpu(&cpu->env);
+
+ lcc->parent_realize(dev, errp);
+}
+
static void lm32_cpu_initfn(Object *obj)
{
LM32CPU *cpu = LM32_CPU(obj);
@@ -50,14 +62,16 @@ static void lm32_cpu_initfn(Object *obj)
cpu_exec_init(env);
env->flags = 0;
-
- cpu_reset(CPU(cpu));
}
static void lm32_cpu_class_init(ObjectClass *oc, void *data)
{
LM32CPUClass *lcc = LM32_CPU_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
+ DeviceClass *dc = DEVICE_CLASS(oc);
+
+ lcc->parent_realize = dc->realize;
+ dc->realize = lm32_cpu_realizefn;
lcc->parent_reset = cc->reset;
cc->reset = lm32_cpu_reset;