Content #
在x86架构中,IDTR (中断描述符表寄存器) 需要通过lidt指令加载一个6字节的操作数,这6字节包含了IDT的界限(limit)和基地址(base)。
lidt idt_descr
idt_descr就是定义了这个6字节结构。
.align 2
.word 0
idt_descr:
.word 256*8-1 # idt contains 256 entries(0x07FF)
.long _idt
图右下侧即为将EDX和EAX的内容反复填入IDT的条目中。 setup_idt: lea ignore_int,%edx movl $0x00080000,%eax movw %dx,%ax * selector = 0x0008 = cs * movw $0x8E00,%dx * interrupt gate - dpl=0, present *
lea \_idt,%edi
mov $256,%ecx
rp_sidt: movl %eax,(%edi) movl %edx,4(%edi) addl $8,%edi dec %ecx jne rp_sidt lidt idt_descr ret
From #
Linux内核设计的艺术