Refactor the target-specific halt-to-execution transition logic (disable WFE/WFI timers, clear the halt_reason flag) into a separate arm_cpu_transition_halt_to_exec() function.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- target/arm/cpu.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 77aa78f00e2..8e9b584559d 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -870,18 +870,26 @@ static bool arm_cpu_internal_is_big_endian(CPUState *cs) } #ifdef CONFIG_TCG +static void arm_cpu_transition_halt_to_exec(CPUState *cs) +{ + ARMCPU *cpu = ARM_CPU(cs); + + assert(cpu_has_work(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_transition_halt_to_exec(cs); } return leave_halt; } -- 2.53.0
