diff --git a/qemu/accel/tcg/cpu-exec.c b/qemu/accel/tcg/cpu-exec.c index 36855aa5..9bf48c8a 100644 --- a/qemu/accel/tcg/cpu-exec.c +++ b/qemu/accel/tcg/cpu-exec.c @@ -242,7 +242,7 @@ static inline TranslationBlock *tb_find(CPUState *cpu, } #endif /* See if we can patch the calling TB. */ - if (last_tb && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + if (last_tb) { if (!acquired_tb_lock) { // Unicorn: commented out //tb_lock(); diff --git a/qemu/tcg/tcg-op.c b/qemu/tcg/tcg-op.c index e32fe7a6..a6b04d91 100644 --- a/qemu/tcg/tcg-op.c +++ b/qemu/tcg/tcg-op.c @@ -2600,6 +2600,10 @@ void tcg_gen_exit_tb(TCGContext *s, TranslationBlock *tb, unsigned idx) seen this numbered exit before, via tcg_gen_goto_tb. */ tcg_debug_assert(tcg_ctx->goto_tb_issue_mask & (1 << idx)); #endif + /* When not chaining, exit without indicating a link. */ + if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + val = 0; + } } else { /* This is an exit via the exitreq label. */ tcg_debug_assert(idx == TB_EXIT_REQUESTED); @@ -2617,7 +2621,10 @@ void tcg_gen_goto_tb(TCGContext *s, unsigned idx) tcg_debug_assert((s->goto_tb_issue_mask & (1 << idx)) == 0); s->goto_tb_issue_mask |= 1 << idx; #endif - tcg_gen_op1i(s, INDEX_op_goto_tb, idx); + /* When not chaining, we simply fall through to the "fallback" exit. */ + if (!qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { + tcg_gen_op1i(s, INDEX_op_goto_tb, idx); + } } void tcg_gen_lookup_and_goto_ptr(TCGContext *s)