Refactor the target-specific async event processing logic (APIC polling) into a separate x86_cpu_process_async_events() function.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- target/i386/tcg/helper-tcg.h | 1 + target/i386/tcg/system/seg_helper.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index f4b2ff740d5..cab197368b9 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -37,6 +37,7 @@ */ void x86_cpu_do_interrupt(CPUState *cpu); #ifndef CONFIG_USER_ONLY +void x86_cpu_process_async_events(CPUState *cpu); bool x86_cpu_exec_halt(CPUState *cpu); bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); diff --git a/target/i386/tcg/system/seg_helper.c b/target/i386/tcg/system/seg_helper.c index 8c7856be81e..4856a6b3bab 100644 --- a/target/i386/tcg/system/seg_helper.c +++ b/target/i386/tcg/system/seg_helper.c @@ -128,10 +128,9 @@ void x86_cpu_do_interrupt(CPUState *cs) } } -bool x86_cpu_exec_halt(CPUState *cpu) +void x86_cpu_process_async_events(CPUState *cpu) { X86CPU *x86_cpu = X86_CPU(cpu); - CPUX86State *env = &x86_cpu->env; if (cpu_test_interrupt(cpu, CPU_INTERRUPT_POLL)) { bql_lock(); @@ -139,6 +138,14 @@ bool x86_cpu_exec_halt(CPUState *cpu) cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); bql_unlock(); } +} + +bool x86_cpu_exec_halt(CPUState *cpu) +{ + X86CPU *x86_cpu = X86_CPU(cpu); + CPUX86State *env = &x86_cpu->env; + + x86_cpu_process_async_events(cpu); if (!cpu_has_work(cpu)) { return false; -- 2.53.0
