From 092014a6cc85ee94b42646eed2db4a98012e1e31 Mon Sep 17 00:00:00 2001 From: Mio Date: Wed, 31 Aug 2022 23:26:40 +0800 Subject: [PATCH] Don't sync pc if user requests a restart --- qemu/accel/tcg/cpu-exec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/qemu/accel/tcg/cpu-exec.c b/qemu/accel/tcg/cpu-exec.c index 688cc98c..05266c6f 100644 --- a/qemu/accel/tcg/cpu-exec.c +++ b/qemu/accel/tcg/cpu-exec.c @@ -86,11 +86,14 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb) case UC_ERR_FETCH_UNALIGNED: break; default: - if (cc->synchronize_from_tb) { - cc->synchronize_from_tb(cpu, last_tb); - } else { - assert(cc->set_pc); - cc->set_pc(cpu, last_tb->pc); + // If we receive a quit request, users has sync-ed PC themselves. + if (!cpu->uc->quit_request) { + if (cc->synchronize_from_tb) { + cc->synchronize_from_tb(cpu, last_tb); + } else { + assert(cc->set_pc); + cc->set_pc(cpu, last_tb->pc); + } } } }