aboutsummaryrefslogtreecommitdiff
path: root/target-microblaze/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-microblaze/cpu.c')
-rw-r--r--target-microblaze/cpu.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c
index 39230fddcc..81359db168 100644
--- a/target-microblaze/cpu.c
+++ b/target-microblaze/cpu.c
@@ -85,14 +85,33 @@ static void mb_cpu_reset(CPUState *s)
#endif
}
+static void mb_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+ MicroBlazeCPU *cpu = MICROBLAZE_CPU(dev);
+ MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_GET_CLASS(dev);
+
+ cpu_reset(CPU(cpu));
+ qemu_init_vcpu(&cpu->env);
+
+ mcc->parent_realize(dev, errp);
+}
+
static void mb_cpu_initfn(Object *obj)
{
+ CPUState *cs = CPU(obj);
MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj);
CPUMBState *env = &cpu->env;
+ static bool tcg_initialized;
+ cs->env_ptr = env;
cpu_exec_init(env);
set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
+
+ if (tcg_enabled() && !tcg_initialized) {
+ tcg_initialized = true;
+ mb_tcg_init();
+ }
}
static const VMStateDescription vmstate_mb_cpu = {
@@ -106,6 +125,9 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
CPUClass *cc = CPU_CLASS(oc);
MicroBlazeCPUClass *mcc = MICROBLAZE_CPU_CLASS(oc);
+ mcc->parent_realize = dc->realize;
+ dc->realize = mb_cpu_realizefn;
+
mcc->parent_reset = cc->reset;
cc->reset = mb_cpu_reset;