From: Christian Borntraeger Date: Thu, 25 Aug 2016 18:11:26 +0000 (+0200) Subject: translate: early exit in tb_flush if there is no tcg X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=135a972b45203ba992afc99ef4f061be8a5acae0;p=qemu.git translate: early exit in tb_flush if there is no tcg tb_flush does all kind of things, which are very tcg specific. As it is called from some places even for KVM (e.g. gdb server) it is better to detect these cases and do an early exit. This also fixes a crash in the gdb server that was triggered by commit 909eaac9bbc2 ("tb hash: track translated blocks with qht"). Suggested-by: Paolo Bonzini Reported-by: Richard Henderson Reported-by: Brent Baccala Signed-off-by: Christian Borntraeger Message-id: 1472148686-39841-1-git-send-email-borntraeger@de.ibm.com> Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- diff --git a/translate-all.c b/translate-all.c index efeba298b9..0dd6466e07 100644 --- a/translate-all.c +++ b/translate-all.c @@ -834,6 +834,9 @@ static void page_flush_tb(void) /* XXX: tb_flush is currently not thread safe */ void tb_flush(CPUState *cpu) { + if (!tcg_enabled()) { + return; + } #if defined(DEBUG_FLUSH) printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n", (unsigned long)(tcg_ctx.code_gen_ptr - tcg_ctx.code_gen_buffer),