From 12fa73f2b627b314570d5aba45ddfa5ff064f822 Mon Sep 17 00:00:00 2001 From: lazymio Date: Sat, 5 Mar 2022 22:35:58 +0100 Subject: [PATCH] Generate check_exit_request for the first tb Consider this case: t:inc ecx, inc edx, jmp t It would generate exactly one block and TB chain will generate an inline jump. If we don't check exit at the entry of the block, we will never be terminated. This test case is recorded in the commit message since it's a bit painful to write multithread related code that builds on all platforms. --- qemu/include/exec/gen-icount.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/qemu/include/exec/gen-icount.h b/qemu/include/exec/gen-icount.h index 988e801e..1a579c05 100644 --- a/qemu/include/exec/gen-icount.h +++ b/qemu/include/exec/gen-icount.h @@ -36,13 +36,6 @@ static inline void gen_tb_start(TCGContext *tcg_ctx, TranslationBlock *tb) tcg_ctx->exitreq_label = gen_new_label(tcg_ctx); - // first TB ever does not need to check exit request - if (tcg_ctx->uc->first_tb) { - // next TB is not the first anymore - tcg_ctx->uc->first_tb = false; - return; - } - count = tcg_temp_new_i32(tcg_ctx); tcg_gen_ld_i32(tcg_ctx, count, tcg_ctx->cpu_env,