summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target-i386/cpu-qom.h4
-rw-r--r--target-i386/cpu.c9
-rw-r--r--target-i386/helper.c2
3 files changed, 13 insertions, 2 deletions
diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
index 40635c4b1c..5901140480 100644
--- a/target-i386/cpu-qom.h
+++ b/target-i386/cpu-qom.h
@@ -22,6 +22,7 @@
#include "qemu/cpu.h"
#include "cpu.h"
+#include "error.h"
#ifdef TARGET_X86_64
#define TYPE_X86_CPU "x86_64-cpu"
@@ -71,5 +72,8 @@ static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
#define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e))
+/* TODO Drop once ObjectClass::realize is available */
+void x86_cpu_realize(Object *obj, Error **errp);
+
#endif
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 65d9af6ac7..89b4ac7ec5 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1722,6 +1722,14 @@ static void mce_init(X86CPU *cpu)
}
}
+void x86_cpu_realize(Object *obj, Error **errp)
+{
+ X86CPU *cpu = X86_CPU(obj);
+
+ mce_init(cpu);
+ qemu_init_vcpu(&cpu->env);
+}
+
static void x86_cpu_initfn(Object *obj)
{
X86CPU *cpu = X86_CPU(obj);
@@ -1755,7 +1763,6 @@ static void x86_cpu_initfn(Object *obj)
x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
env->cpuid_apic_id = env->cpu_index;
- mce_init(cpu);
}
static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 0b22582ed6..3421be2276 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1181,7 +1181,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
return NULL;
}
- qemu_init_vcpu(env);
+ x86_cpu_realize(OBJECT(cpu), NULL);
return env;
}