summaryrefslogtreecommitdiffstats
path: root/target-lm32/cpu.c
diff options
context:
space:
mode:
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 eca2dca..6a84f51 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;
OpenPOWER on IntegriCloud