OSDN Git Service

cpu_common_reset: wrap TCG specific code in tcg_enabled()
authorAlex Bennée <alex.bennee@linaro.org>
Thu, 12 Jan 2017 15:02:50 +0000 (15:02 +0000)
committerAlex Bennée <alex.bennee@linaro.org>
Fri, 13 Jan 2017 14:24:36 +0000 (14:24 +0000)
Both the cpu->tb_jmp_cache and SoftMMU TLB structures are only used
when running TCG code so we might as well skip them for anything else.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
qom/cpu.c

index cc51de2..61ee0cb 100644 (file)
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -270,13 +270,15 @@ static void cpu_common_reset(CPUState *cpu)
     cpu->exception_index = -1;
     cpu->crash_occurred = false;
 
-    for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
-        atomic_set(&cpu->tb_jmp_cache[i], NULL);
-    }
+    if (tcg_enabled()) {
+        for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
+            atomic_set(&cpu->tb_jmp_cache[i], NULL);
+        }
 
 #ifdef CONFIG_SOFTMMU
-    tlb_flush(cpu, 0);
+        tlb_flush(cpu, 0);
 #endif
+    }
 }
 
 static bool cpu_common_has_work(CPUState *cs)