debug(idt): 非 #GP/#PF 异常打印 rip/rsp,定位 tid=1 #UD 执行位置
This commit is contained in:
1 parent
61208676c6
commit
cdee5e0e87
1 file changed
+10
@@ -142,6 +142,16 @@ def isrCommonhandler(interrupt: t.CInt):
|
||||
viperlib.snprintf(c.Addr(gp_buf), 140, "[GP] rip=0x%lx err=0x%lx rsp=0x%lx cr4=0x%lx cr0=0x%lx\n",
|
||||
gp_rip, gp_err, gp_rsp, gp_cr4, gp_cr0)
|
||||
serial.puts(gp_buf)
|
||||
else:
|
||||
# 其他异常(#UD 等):打印 rip/rsp 定位执行位置(isr.s 已保存 _fault_rip)
|
||||
ex_rip: t.CUInt64T = 0
|
||||
ex_rsp: t.CUInt64T = 0
|
||||
c.Asm(f"""mov {c.AsmOut(ex_rip, t.ASM_DESCR.OUTPUT_REG)}, [_fault_rip]
|
||||
mov {c.AsmOut(ex_rsp, t.ASM_DESCR.OUTPUT_REG)}, [_fault_rsp]""",
|
||||
op=[t.ASM_DESCR.CLOBBER_RAX])
|
||||
ex_buf: t.CArray[t.CChar, 100]
|
||||
viperlib.snprintf(c.Addr(ex_buf), 100, "[EX] int=%d rip=0x%lx rsp=0x%lx\n", interrupt, ex_rip, ex_rsp)
|
||||
serial.puts(ex_buf)
|
||||
s: sched.Scheduler | t.CPtr = sched._sched_ptr
|
||||
# 如果调度器未初始化,直接进入安全停机状态
|
||||
if s == 0:
|
||||
|
||||
Reference in new issue
Block a user