Patchwork [RFC,qom-cpu,v2,20/28] target-m68k: Move TCG initialization to M68kCPU initfn

login
register
mail settings
Submitter Andreas Färber
Date Jan. 20, 2013, 7:22 a.m.
Message ID <1358666571-1737-21-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/213921/
State New
Headers show

Comments

Andreas Färber - Jan. 20, 2013, 7:22 a.m.
Add a tcg_enabled() check to suppress it for qtest.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-m68k/cpu.c    |    6 ++++++
 target-m68k/helper.c |    7 -------
 2 Dateien geändert, 6 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-)

Patch

diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c
index f6720ca..bbeae28 100644
--- a/target-m68k/cpu.c
+++ b/target-m68k/cpu.c
@@ -136,8 +136,14 @@  static void m68k_cpu_initfn(Object *obj)
 {
     M68kCPU *cpu = M68K_CPU(obj);
     CPUM68KState *env = &cpu->env;
+    static bool inited;
 
     cpu_exec_init(env);
+
+    if (tcg_enabled() && !inited) {
+        inited = true;
+        m68k_tcg_init();
+    }
 }
 
 static void m68k_cpu_class_init(ObjectClass *c, void *data)
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index f2d3059..920dfa9 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -97,19 +97,12 @@  CPUM68KState *cpu_m68k_init(const char *cpu_model)
 {
     M68kCPU *cpu;
     CPUM68KState *env;
-    static int inited;
 
     if (object_class_by_name(cpu_model) == NULL) {
         return NULL;
     }
     cpu = M68K_CPU(object_new(cpu_model));
     env = &cpu->env;
-
-    if (!inited) {
-        inited = 1;
-        m68k_tcg_init();
-    }
-
     env->cpu_model_str = cpu_model;
 
     register_m68k_insns(env);