如何使用 LIDT 创建 IDT 我在 Intel-Atom 32 位(汇编 AT&T)上工作
如何使用 LIDT 创建 IDT 我从事 Intel-Atom 32 位(Assembly AT&T)工作。 我使用 MocroC OSII 作为操作系统, 我这样做了,但它不起作用:
Load_IDT:
push %ebp //save the context to swith back
mov %esp,%ebp
movw $256*8, -6(%esp) //256 ISR possible
movl $IDT, -4(%esp) //IDT is a table of 256*8bytes
lidt -6(%esp)
pop %ebp //Return to the calling function
ret
static void fill_interrupt(unsigned char num, unsigned int base, unsigned short sel, unsigned char flags)
{
unsigned short *Interrupt_Address;
/*address = idt_ptr.base + num * 8 byte*/
Interrupt_Address = (unsigned short *)(idt_ptr.base + num*8);
*(Interrupt_Address) = base&0xFFFF;
*(Interrupt_Address+1) = sel;
*(Interrupt_Address+1) = (flags>>4)&0xFF00;
*(Interrupt_Address+1) = (base>>16)&0xFFFF;
}
/*Change the address of idt_entries table */
fill_interrupt(ISR_Nbr,(unsigned int) isr33, 0x08, 0x8E);
How to create an IDT using LIDT
I work on Intel-Atom 32bits (Assembly AT&T).
I am using the MocroC OSII as an OS,
i did this but it doesn,t work:
Load_IDT:
push %ebp //save the context to swith back
mov %esp,%ebp
movw $256*8, -6(%esp) //256 ISR possible
movl $IDT, -4(%esp) //IDT is a table of 256*8bytes
lidt -6(%esp)
pop %ebp //Return to the calling function
ret
static void fill_interrupt(unsigned char num, unsigned int base, unsigned short sel, unsigned char flags)
{
unsigned short *Interrupt_Address;
/*address = idt_ptr.base + num * 8 byte*/
Interrupt_Address = (unsigned short *)(idt_ptr.base + num*8);
*(Interrupt_Address) = base&0xFFFF;
*(Interrupt_Address+1) = sel;
*(Interrupt_Address+1) = (flags>>4)&0xFF00;
*(Interrupt_Address+1) = (base>>16)&0xFFFF;
}
/*Change the address of idt_entries table */
fill_interrupt(ISR_Nbr,(unsigned int) isr33, 0x08, 0x8E);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决:),因为有BIOS,它已经内置了GDT/IDT。
Resolved :), as there is a BIOS, it already built the GDT/IDT.