aboutsummaryrefslogtreecommitdiff
path: root/target-unicore32/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-unicore32/cpu.c')
-rw-r--r--target-unicore32/cpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index 4e4177fc57..8de17a49d6 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -81,6 +81,16 @@ static const UniCore32CPUInfo uc32_cpus[] = {
{ .name = "any", .instance_init = uc32_any_cpu_initfn },
};
+static void uc32_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+ UniCore32CPU *cpu = UNICORE32_CPU(dev);
+ UniCore32CPUClass *ucc = UNICORE32_CPU_GET_CLASS(dev);
+
+ qemu_init_vcpu(&cpu->env);
+
+ ucc->parent_realize(dev, errp);
+}
+
static void uc32_cpu_initfn(Object *obj)
{
UniCore32CPU *cpu = UNICORE32_CPU(obj);
@@ -108,6 +118,10 @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
+ UniCore32CPUClass *ucc = UNICORE32_CPU_CLASS(oc);
+
+ ucc->parent_realize = dc->realize;
+ dc->realize = uc32_cpu_realizefn;
cc->class_by_name = uc32_cpu_class_by_name;
dc->vmsd = &vmstate_uc32_cpu;