]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-i386: Move TCG initialization check to tcg_x86_init()
authorEduardo Habkost <ehabkost@redhat.com>
Thu, 5 Mar 2015 16:43:16 +0000 (13:43 -0300)
committerEduardo Habkost <ehabkost@redhat.com>
Mon, 23 May 2016 22:47:37 +0000 (19:47 -0300)
Instead of requiring cpu.c to check if TCG was already initialized,
simply let the function be called multiple times.

Suggested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
target-i386/cpu.c
target-i386/translate.c

index e6154865960c5d3e70bf4dc878cbd6d084e70ce4..2dc3d3cf3bbc933f710ebb246605ab6aba7b3d14 100644 (file)
@@ -3088,7 +3088,6 @@ static void x86_cpu_initfn(Object *obj)
     X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
     CPUX86State *env = &cpu->env;
     FeatureWord w;
-    static int inited;
 
     cs->env_ptr = env;
     cpu_exec_init(cs, &error_abort);
@@ -3139,8 +3138,7 @@ static void x86_cpu_initfn(Object *obj)
     x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort);
 
     /* init various static tables used in TCG mode */
-    if (tcg_enabled() && !inited) {
-        inited = 1;
+    if (tcg_enabled()) {
         tcg_x86_init();
     }
 }
index 731b10de06ac47c985e76a0bb1781d984d6b96c4..bf33e6b3536e38465ccc1e2a48c14c867f2e5a4e 100644 (file)
@@ -8144,6 +8144,12 @@ void tcg_x86_init(void)
         "bnd0_ub", "bnd1_ub", "bnd2_ub", "bnd3_ub"
     };
     int i;
+    static bool initialized;
+
+    if (initialized) {
+        return;
+    }
+    initialized = true;
 
     cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
     cpu_cc_op = tcg_global_mem_new_i32(cpu_env,