diff options
| author | Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> | 2026-08-19 14:24:20 +0200 |
|---|---|---|
| committer | Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> | 2026-09-03 12:14:08 +0200 |
| commit | 0ee22ea30bfd8d4eff1ae2d06f1e09b19788a526 (patch) | |
| tree | 99ea2971fbf7de8f055815bad066fa904bbc6995 /accel | |
| parent | 5bcb5c4413aa397b7e10bef55a0273885d462bb3 (diff) | |
| download | qemu-0ee22ea30bfd8d4eff1ae2d06f1e09b19788a526.tar.gz qemu-0ee22ea30bfd8d4eff1ae2d06f1e09b19788a526.zip | |
accel/tcg: Check %halted field in cpu_handle_halt() caller
In cpu_exec(), check CPUState::halted field early before
calling cpu_handle_halt(). The logic is the same but allow
to simplify the async event processing hooks that will be
added in the next commit.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260819145649.23439-4-philmd@oss.qualcomm.com>
Diffstat (limited to 'accel')
| -rw-r--r-- | accel/tcg/cpu-exec.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 69207301d1..46b723cb73 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -656,17 +656,15 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, #ifndef CONFIG_USER_ONLY static inline bool cpu_handle_halt(CPUState *cpu) { - if (cpu->halted) { - const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops; - bool leave_halt = tcg_ops->cpu_exec_halt(cpu); - - if (!leave_halt) { - return true; - } + const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops; + bool leave_halt = tcg_ops->cpu_exec_halt(cpu); - cpu->halted = 0; + if (!leave_halt) { + return true; } + cpu->halted = 0; /* allow execution */ + return false; } #endif /* !CONFIG_USER_ONLY */ @@ -1028,8 +1026,11 @@ int cpu_exec(CPUState *cpu) current_cpu = cpu; #ifndef CONFIG_USER_ONLY - if (cpu_handle_halt(cpu)) { - return EXCP_HALTED; + if (cpu->halted) { + if (cpu_handle_halt(cpu)) { + return EXCP_HALTED; + } + assert(!cpu->halted); } #endif |
