From 79614b781df5096ffecf531992314781dbab54af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 19 Jan 2013 07:37:45 +0100 Subject: [PATCH] target-arm: Move TCG initialization to ARMCPU initfn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensures that a QOM-created ARMCPU is usable. Signed-off-by: Andreas Färber --- target-arm/cpu.c | 6 ++++++ target-arm/helper.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 9915172a1d..f54d20057d 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -135,10 +135,16 @@ static inline void set_feature(CPUARMState *env, int feature) static void arm_cpu_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); + static bool inited; cpu_exec_init(&cpu->env); cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, g_free); + + if (tcg_enabled() && !inited) { + inited = true; + arm_translate_init(); + } } static void arm_cpu_finalizefn(Object *obj) diff --git a/target-arm/helper.c b/target-arm/helper.c index 4538a09445..e63da57a51 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1263,7 +1263,6 @@ ARMCPU *cpu_arm_init(const char *cpu_model) ARMCPU *cpu; CPUARMState *env; ObjectClass *oc; - static int inited = 0; oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model); if (!oc) { @@ -1276,11 +1275,6 @@ ARMCPU *cpu_arm_init(const char *cpu_model) /* TODO this should be set centrally, once possible */ object_property_set_bool(OBJECT(cpu), true, "realized", NULL); - if (tcg_enabled() && !inited) { - inited = 1; - arm_translate_init(); - } - return cpu; }