fix(timer): timer_handler 补 LAPIC EOI,修复 APIC 启用后定时中断被屏蔽
APIC 启用后(LINT0=EXTINT 送达),每次中断会置 LAPIC ISR,必须写 LAPIC_EOI(0x0B0) 清除。此前只发 PIC EOI(0x20/0xA0),LAPIC ISR 卡住 → 首个定时中断后后续中断全被屏蔽 → ticks 不推进 → timer_msleep 永久挂起 (清理诊断后稳定复现,serial.log 停在 "sti done" 无 "msleep done")。 两个分支(timer_running 早退 + 正常路径)都补 apic.eoi()。
This commit is contained in:
1 parent
f675540c64
commit
9082056fe0
1 file changed
+6
@@ -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
|
||||
|
||||
Reference in new issue
Block a user