Add a tcg_enabled() check to suppress it for qtest.

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

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);
-- 
1.7.10.4


Reply via email to