Patchwork [19/47] target-lm32: Move TCG initialization to LM32CPU initfn

login
register
mail settings
Submitter Andreas Färber
Date Feb. 16, 2013, 3:45 p.m.
Message ID <1361029542-8412-20-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/220999/
State New
Headers show

Comments

Andreas Färber - Feb. 16, 2013, 3:45 p.m.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-lm32/cpu.c    |    6 ++++++
 target-lm32/helper.c |    6 ------
 2 Dateien geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)

Patch

diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c
index 6a84f51..5f16734 100644
--- a/target-lm32/cpu.c
+++ b/target-lm32/cpu.c
@@ -58,10 +58,16 @@  static void lm32_cpu_initfn(Object *obj)
 {
     LM32CPU *cpu = LM32_CPU(obj);
     CPULM32State *env = &cpu->env;
+    static bool tcg_initialized;
 
     cpu_exec_init(env);
 
     env->flags = 0;
+
+    if (tcg_enabled() && !tcg_initialized) {
+        tcg_initialized = true;
+        lm32_translate_init();
+    }
 }
 
 static void lm32_cpu_class_init(ObjectClass *oc, void *data)
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index a6691ad..47ae7e7 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -197,7 +197,6 @@  LM32CPU *cpu_lm32_init(const char *cpu_model)
     LM32CPU *cpu;
     CPULM32State *env;
     const LM32Def *def;
-    static int tcg_initialized;
 
     def = cpu_lm32_find_by_name(cpu_model);
     if (!def) {
@@ -212,11 +211,6 @@  LM32CPU *cpu_lm32_init(const char *cpu_model)
     env->num_wps = def->num_watchpoints;
     env->cfg = cfg_by_def(def);
 
-    if (tcg_enabled() && !tcg_initialized) {
-        tcg_initialized = 1;
-        lm32_translate_init();
-    }
-
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
     return cpu;