diff --git a/VKernel/Kernel/platform/pch/timer.vp b/VKernel/Kernel/platform/pch/timer.vp index 9b45895..da8cd0e 100644 --- a/VKernel/Kernel/platform/pch/timer.vp +++ b/VKernel/Kernel/platform/pch/timer.vp @@ -1,6 +1,7 @@ import platform.pch.pic as pic import platform.pch.pit as pit import sched.sched as sched +import drivers.core.cpu.apic as apic import asm import t, c @@ -27,6 +28,7 @@ def timer_handler(): global ticks, seconds, milliseconds, timer_running if not timer_running: pic.eoi(0) + apic.eoi() return c.Asm("mfence", op=[t.ASM_DESCR.CLOBBER_MEMORY]) ticks = ticks + 1 @@ -37,6 +39,10 @@ def timer_handler(): c.Asm("mfence", op=[t.ASM_DESCR.CLOBBER_MEMORY]) sched.Scheduler.sched_tick() pic.eoi(0) + # LAPIC EOI:APIC 启用后中断经 LINT0(EXTINT) 送达会置 LAPIC ISR, + # 只发 PIC EOI 不清 LAPIC ISR → 首个定时中断后后续中断被屏蔽 → + # ticks 不推进 → msleep 永久挂起(QEMU/OVMF 下 APIC 必启用)。 + apic.eoi() def timer_start(): global timer_running