我需要 GDT 来构建 IDT 吗?

发布于 2024-12-07 16:23:54 字数 705 浏览 1 评论 0原文

我正在开发 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千寻… 2024-12-14 16:23:54

基本上,是的。您必须有一个 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.

东风软 2024-12-14 16:23:54

已解决:),因为有一个 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文