]> git.proxmox.com Git - qemu.git/commitdiff
target-s390x: Move TCG initialization to S390CPU initfn
authorAndreas Färber <afaerber@suse.de>
Sat, 19 Jan 2013 21:43:32 +0000 (22:43 +0100)
committerAndreas Färber <afaerber@suse.de>
Sat, 16 Feb 2013 13:50:58 +0000 (14:50 +0100)
Ensures that a QOM-created S390CPU is usable.

Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x/cpu.c
target-s390x/helper.c

index ee15783b94886331257a6080f120b3d858d0999e..787c937579593253b278c05d5eaab13d2fd0fcd8 100644 (file)
@@ -112,6 +112,7 @@ static void s390_cpu_initfn(Object *obj)
 {
     S390CPU *cpu = S390_CPU(obj);
     CPUS390XState *env = &cpu->env;
+    static bool inited;
     static int cpu_num = 0;
 #if !defined(CONFIG_USER_ONLY)
     struct tm tm;
@@ -133,6 +134,11 @@ static void s390_cpu_initfn(Object *obj)
 #endif
     env->cpu_num = cpu_num++;
     env->ext_index = -1;
+
+    if (tcg_enabled() && !inited) {
+        inited = true;
+        s390x_translate_init();
+    }
 }
 
 static void s390_cpu_finalize(Object *obj)
index d3bb4561f14496a2b39c0aa59dfc3e6143063e6b..1183b45ca1de28b33ce5be2ef61e5e0bef4bd5b0 100644 (file)
@@ -74,16 +74,9 @@ S390CPU *cpu_s390x_init(const char *cpu_model)
 {
     S390CPU *cpu;
     CPUS390XState *env;
-    static int inited;
 
     cpu = S390_CPU(object_new(TYPE_S390_CPU));
     env = &cpu->env;
-
-    if (tcg_enabled() && !inited) {
-        inited = 1;
-        s390x_translate_init();
-    }
-
     env->cpu_model_str = cpu_model;
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);