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
This commit is contained in:
Alex Bennée 2018-03-01 19:22:53 -05:00 committed by Lioncash
parent 780ed8722e
commit 7e2cc86ad2
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -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)