From f675540c64f8b80fc2d89b09d41a628fb1d4584d Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Wed, 26 Aug 2026 18:19:41 +0800 Subject: [PATCH] =?UTF-8?q?chore(boot):=20=E7=A7=BB=E9=99=A4=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E4=B8=AD=E6=96=AD=E6=8E=92=E6=9F=A5=E8=AF=8A=E6=96=AD?= =?UTF-8?q?=EF=BC=88int20=20=E6=B5=8B=E8=AF=95=20+=20T/[T]/D=20=E6=89=93?= =?UTF-8?q?=E5=8D=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 定时中断已确认恢复(APIC LINT0=EXTINT)。移除 int 0x20 软件触发测试与 isr32_handler 'T'、timer_handler '[T]'、isr_default 'D' 打印,回归干净 内核,定位 sti 后新出现的 #GP(疑似 int 0x20 测试触发)。 --- VKernel/Kernel/intr/idt.vp | 2 -- VKernel/Kernel/intr/isr.s | 3 --- VKernel/Kernel/main.vp | 5 ----- VKernel/Kernel/platform/pch/timer.vp | 8 +------- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/VKernel/Kernel/intr/idt.vp b/VKernel/Kernel/intr/idt.vp index 31b4ea2..ba571f0 100644 --- a/VKernel/Kernel/intr/idt.vp +++ b/VKernel/Kernel/intr/idt.vp @@ -201,8 +201,6 @@ def isr29_handler() -> t.CExport | t.CVoid: isrCommonhandler(29) def isr30_handler() -> t.CExport | t.CVoid: isrCommonhandler(30) def isr31_handler() -> t.CExport | t.CVoid: isrCommonhandler(31) def isr32_handler() -> t.CExport | t.CVoid: - # [DBG] 中断入口诊断:若打印 'T' 说明 IRQ0 到达 isr32(用后移除) - serial.puts("T") timer.timer_handler() def isr33_handler() -> t.CExport | t.CVoid: diff --git a/VKernel/Kernel/intr/isr.s b/VKernel/Kernel/intr/isr.s index 152a9f5..c03757f 100644 --- a/VKernel/Kernel/intr/isr.s +++ b/VKernel/Kernel/intr/isr.s @@ -16,9 +16,6 @@ isr_default: push rax push rdx - mov dx, 0x3F8 - mov al, 0x44 # [DBG] 'D' = 中断向量到默认处理(用后移除) - out dx, al mov al, 0x20 out 0xA0, al out 0x20, al diff --git a/VKernel/Kernel/main.vp b/VKernel/Kernel/main.vp index c74600d..7d17b4e 100644 --- a/VKernel/Kernel/main.vp +++ b/VKernel/Kernel/main.vp @@ -81,11 +81,6 @@ class ViperKernel: asm.sti() serial.puts("[main] sti done\n") - # [DBG] 软件触发向量 32:验证 IDT gate 是否生效(用后移除) - # 有 "T" → IDT 正常,问题在 PIT/PIC 硬件送达;无 "T" → IDT/lidt 问题 - c.Asm("int 0x20", op=[t.ASM_DESCR.CLOBBER_MEMORY]) - serial.puts("[main] int20 test done\n") - timer.timer_msleep(100) serial.puts("[main] msleep done\n") rtc.rtc_init() diff --git a/VKernel/Kernel/platform/pch/timer.vp b/VKernel/Kernel/platform/pch/timer.vp index ec7cac9..9b45895 100644 --- a/VKernel/Kernel/platform/pch/timer.vp +++ b/VKernel/Kernel/platform/pch/timer.vp @@ -1,7 +1,6 @@ import platform.pch.pic as pic import platform.pch.pit as pit import sched.sched as sched -import drivers.serial.uart.serial as serial import asm import t, c @@ -13,7 +12,6 @@ ticks: t.CStatic | t.CVolatile | t.CUInt64T = 0 seconds: t.CStatic | t.CVolatile | t.CUInt32T = 0 milliseconds: t.CStatic | t.CVolatile | t.CUInt32T = 0 timer_running: t.CStatic | t.CVolatile | bool = False -_dbg_last: t.CUInt64T = 0 def timer_init(): global ticks, seconds, milliseconds, timer_running @@ -26,7 +24,7 @@ def timer_init(): pit.pit_init(TIMER_FREQUENCY) def timer_handler(): - global ticks, seconds, milliseconds, timer_running, _dbg_last + global ticks, seconds, milliseconds, timer_running if not timer_running: pic.eoi(0) return @@ -37,10 +35,6 @@ def timer_handler(): seconds = seconds + 1 milliseconds = milliseconds - 1000 c.Asm("mfence", op=[t.ASM_DESCR.CLOBBER_MEMORY]) - # [DBG] 每 250 拍打印一次,验证定时器中断是否触发(排查 sti 后挂起,用后移除) - if ticks - _dbg_last >= 250: - _dbg_last = ticks - serial.puts("[T]") sched.Scheduler.sched_tick() pic.eoi(0)