From 7e2cc86ad262442fdf1fb1faca38786bc1c42bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 1 Mar 2018 19:22:53 -0500 Subject: [PATCH] cpu_common_reset: wrap TCG specific code in tcg_enabled() 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. Backports commit ba7d3d1858c257e39b47f7f12fa2016ffd960b11 from qemu --- qemu/qom/cpu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/qemu/qom/cpu.c b/qemu/qom/cpu.c index 56a4e933..e107a105 100644 --- a/qemu/qom/cpu.c +++ b/qemu/qom/cpu.c @@ -172,13 +172,18 @@ 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); - } + // TODO: Should be uncommented, but good 'ol + // unicorn's crappy symbol deduplication + // makes it impossible right now + //if (tcg_enabled(cpu->uc)) { + 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)