Move WFxT timer cleanup and halt-reason reset into arm_cpu_leaving_halt(). Keep arm_cpu_exec_halt() focused on deciding whether the CPU can leave the halted state.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Richard Henderson <[email protected]> --- target/arm/cpu.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ccc6630026c..4863e7cd450 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -872,18 +872,24 @@ static bool arm_cpu_internal_is_big_endian(CPUState *cs) } #ifdef CONFIG_TCG +static void arm_cpu_leaving_halt(CPUState *cs) +{ + ARMCPU *cpu = ARM_CPU(cs); + + /* We're about to come out of WFI/WFE: disable the WFxT timer */ + if (cpu->wfxt_timer) { + timer_del(cpu->wfxt_timer); + } + /* clear the halt reason */ + cpu->env.halt_reason = NOT_HALTED; +} + bool arm_cpu_exec_halt(CPUState *cs) { bool leave_halt = cpu_has_work(cs); if (leave_halt) { - /* We're about to come out of WFI/WFE: disable the WFxT timer */ - ARMCPU *cpu = ARM_CPU(cs); - if (cpu->wfxt_timer) { - timer_del(cpu->wfxt_timer); - } - /* clear the halt reason */ - cpu->env.halt_reason = NOT_HALTED; + arm_cpu_leaving_halt(cs); } return leave_halt; } -- 2.53.0
