3
我想在Bochs上安裝一箇中斷處理程序,但由於某種原因,我的中斷處理程序沒有觸發。爲什麼我的中斷處理程序不能觸發?
首先,我設置斷點:
00036440222i[CPU0 ] [36440222] Stopped on MAGIC BREAKPOINT
(0) [0x0000000000703044] 0008:00000000c0003044 (unk. ctxt): int3
然後我嘗試執行int 3
。
當我這樣做,但是,錯誤說int_trap_gate(): selector null
,這似乎是在告訴我一些表選擇爲空。
然而,GDT如下:
<bochs:2> info gdt
Global Descriptor Table (base=0x0000000000007c08, limit=23):
GDT[0x00]=??? descriptor hi=0x00000000, lo=0x00000000
GDT[0x01]=Code segment, base=0x00000000, limit=0xffffffff, Execute/Read, Accessed, 32-bit
GDT[0x02]=Data segment, base=0x00000000, limit=0xffffffff, Read/Write, Accessed
等特點,是IDT:
<bochs:3> info idt
Interrupt Descriptor Table (base=0x00000000c0101020, limit=2047):
IDT[0x00]=32-Bit Interrupt Gate target=0x0001:0xc0004148, DPL=0
IDT[0x01]=32-Bit Interrupt Gate target=0x0001:0xc0004154, DPL=0
IDT[0x02]=32-Bit Interrupt Gate target=0x0001:0xc0004160, DPL=0
IDT[0x03]=32-Bit Interrupt Gate target=0x0001:0xc000416c, DPL=0
IDT[0x04]=32-Bit Interrupt Gate target=0x0001:0xc0004178, DPL=0
IDT[0x05]=32-Bit Interrupt Gate target=0x0001:0xc0004184, DPL=0
IDT[0x06]=32-Bit Interrupt Gate target=0x0001:0xc0004190, DPL=0
IDT[0x07]=32-Bit Interrupt Gate target=0x0001:0xc000419c, DPL=0
IDT[0x08]=32-Bit Interrupt Gate target=0x0001:0xc00041a8, DPL=0
IDT[0x09]=32-Bit Interrupt Gate target=0x0001:0xc00041b0, DPL=0
IDT[0x0a]=32-Bit Interrupt Gate target=0x0001:0xc00041bc, DPL=0
IDT[0x0b]=32-Bit Interrupt Gate target=0x0001:0xc00041c4, DPL=0
IDT[0x0c]=32-Bit Interrupt Gate target=0x0001:0xc00041cc, DPL=0
IDT[0x0d]=32-Bit Interrupt Gate target=0x0001:0xc00041d4, DPL=0
IDT[0x0e]=32-Bit Interrupt Gate target=0x0001:0xc00041dc, DPL=0
IDT[0x0f]=32-Bit Interrupt Gate target=0x0001:0xc00041e4, DPL=0
IDT[0x10]=32-Bit Interrupt Gate target=0x0001:0xc00041f0, DPL=0
IDT[0x11]=32-Bit Interrupt Gate target=0x0001:0xc00041fc, DPL=0
IDT[0x12]=32-Bit Interrupt Gate target=0x0001:0xc0004208, DPL=0
IDT[0x13]=32-Bit Interrupt Gate target=0x0001:0xc0004214, DPL=0
IDT[0x14]=32-Bit Interrupt Gate target=0x0001:0xc0004220, DPL=0
IDT[0x15]=32-Bit Interrupt Gate target=0x0001:0xc000422c, DPL=0
IDT[0x16]=32-Bit Interrupt Gate target=0x0001:0xc0004238, DPL=0
IDT[0x17]=32-Bit Interrupt Gate target=0x0001:0xc0004244, DPL=0
IDT[0x18]=32-Bit Interrupt Gate target=0x0001:0xc0004250, DPL=0
IDT[0x19]=32-Bit Interrupt Gate target=0x0001:0xc000425c, DPL=0
IDT[0x1a]=32-Bit Interrupt Gate target=0x0001:0xc0004268, DPL=0
IDT[0x1b]=32-Bit Interrupt Gate target=0x0001:0xc0004274, DPL=0
IDT[0x1c]=32-Bit Interrupt Gate target=0x0001:0xc0004280, DPL=0
IDT[0x1d]=32-Bit Interrupt Gate target=0x0001:0xc000428c, DPL=0
IDT[0x1e]=32-Bit Interrupt Gate target=0x0001:0xc0004298, DPL=0
IDT[0x1f]=??? descriptor hi=0x00000000, lo=0x00000000
<...>
IDT[0xff]=??? descriptor hi=0x00000000, lo=0x00000000
在我看來,該IDT條目具有有效的GDT選擇,所以我不知道了解是什麼原因導致的問題,當我執行中斷:
<bochs:5> s ; step
(0).[36440222] [0x0000000000703044] 0008:00000000c0003044 (unk. ctxt): int3
CPU 0: Interrupt 0x03 occured (error_code=0x0000)
00036440222e[CPU0 ] int_trap_gate(): selector null
CPU 0: Exception 0x0d - (#GP) general protection fault occured (error_code=0x0000)
CPU 0: Interrupt 0x0d occured (error_code=0x0000)
00036440222e[CPU0 ] int_trap_gate(): selector null
CPU 0: Exception 0x0d - (#GP) general protection fault occured (error_code=0x0000)
CPU 0: Exception 0x08 - (#DF) double fault occured (error_code=0x0000)
CPU 0: Interrupt 0x08 occured (error_code=0x0000)
00036440222e[CPU0 ] int_trap_gate(): selector null
CPU 0: Exception 0x0d - (#GP) general protection fault occured (error_code=0x0000)
問題是什麼?
Oooooooooooohhhhhh好的非常感謝! +1 – Mehrdad