我需要 GDT 来构建 IDT 吗?
我正在开发 Atom-32 位板(AT&T 组装),该板上还没有软件。
我是否需要构建 GDT 才能构建/使用 IDT ?
这个想法只是将 ISR 与 APIC 定时器结合使用。
/*Change the address of idt_entries table */
fill_interrupt(ISR_Nbr,(unsigned int) isr33, 0x08, 0x8E);
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>>8)&0xFF00;
*(Interrupt_Address+1) = (base>>16)&0xFFFF;
}
I am working on Atom-32bit board (AT&T assembly), there is no software on this board yet.
Do I need to build GDT to build/use an IDT ?
The idea is just to use an ISR with APIC timer.
/*Change the address of idt_entries table */
fill_interrupt(ISR_Nbr,(unsigned int) isr33, 0x08, 0x8E);
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>>8)&0xFF00;
*(Interrupt_Address+1) = (base>>16)&0xFFFF;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本上,是的。您必须有一个 GDT,以便可以有一个段来“指向”IDT 中断向量。请注意,(据我所知)您可以同时加载 IDT 和 GDT,但只有加载 GDT 后才能使用 IDT。如果你尝试这样做,最多只会犯三重错误。
Basically, yes. You must have a GDT so that you can have a segment to "point" an IDT interrupt vector at. Note, (as far as I know) you can load both the IDT and GDT at the same time, but you can't make use of the IDT until you have a GDT loaded. If you attempt to you'll, at best, get a triple fault.
已解决:),因为有一个 BIOS,它已经构建了 GDT/IDT,所以我找到了使用 sidt 和 sgdt 指令的地址,并将我的 ISR 添加到 sidt
Resolved :), as there is a BIOS, it already built the GDT/IDT, so I found there address using sidt and sgdt instructions, and i added my ISR to sidt