aboutsummaryrefslogtreecommitdiff
path: root/target-xtensa/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-xtensa/cpu.c')
-rw-r--r--target-xtensa/cpu.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c
index ebc7e99..785e56d 100644
--- a/target-xtensa/cpu.c
+++ b/target-xtensa/cpu.c
@@ -57,12 +57,31 @@ static void xtensa_cpu_reset(CPUState *s)
reset_mmu(env);
}
+static void xtensa_cpu_realizefn(DeviceState *dev, Error **errp)
+{
+ XtensaCPU *cpu = XTENSA_CPU(dev);
+ XtensaCPUClass *xcc = XTENSA_CPU_GET_CLASS(dev);
+
+ qemu_init_vcpu(&cpu->env);
+
+ xcc->parent_realize(dev, errp);
+}
+
static void xtensa_cpu_initfn(Object *obj)
{
+ CPUState *cs = CPU(obj);
XtensaCPU *cpu = XTENSA_CPU(obj);
CPUXtensaState *env = &cpu->env;
+ static bool tcg_inited;
+ cs->env_ptr = env;
cpu_exec_init(env);
+
+ if (tcg_enabled() && !tcg_inited) {
+ tcg_inited = true;
+ xtensa_translate_init();
+ cpu_set_debug_excp_handler(xtensa_breakpoint_handler);
+ }
}
static const VMStateDescription vmstate_xtensa_cpu = {
@@ -76,6 +95,9 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
CPUClass *cc = CPU_CLASS(oc);
XtensaCPUClass *xcc = XTENSA_CPU_CLASS(cc);
+ xcc->parent_realize = dc->realize;
+ dc->realize = xtensa_cpu_realizefn;
+
xcc->parent_reset = cc->reset;
cc->reset = xtensa_cpu_reset;