Atom-32bit-intel主板中的BIOS是否会产生IDT和GDT?
我有 Atom-32bit-intel board n450,里面只有 BIOS,我的目标是使用 APIC 计时器并将其与 ISR (0x21) 链接。 一段时间后,我发现IDT和GDT已经存在(可能是由BIOS构建的)并且不需要构建它们(软件是C语言和AT&T汇编):
/*Read the IDTR*/
sidt (idt_ptr)
/*Read the GDTR*/
sgdt (gdt_ptr)
所以我尝试使用IDT的地址来链接我的ISR 到 IDT:
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+2) = (flags>>8)&0xFF00;
*(Interrupt_Address+3) = (base>>16)&0xFFFF;
}
当我尝试调用 ISR33:int $0x21 时,软件崩溃:SingleStep CPU[1] 错误:处理器正在运行。
那么哪里错了???
评论: 我使用eclipse Heros(AT&T程序集),代码处于保护模式(CR0.PE = 1我检查了它,可能是由BIOS设置的)。
I have Atom-32bit-intel board n450 with only BIOS in it, my goal is to use APIC timer and linke it with an ISR (0x21).
After a while, I discoverd that IDT and GDT already exist(probably built by the BIOS) and no need to build them (the software is in C language and AT&T assembly):
/*Read the IDTR*/
sidt (idt_ptr)
/*Read the GDTR*/
sgdt (gdt_ptr)
So I tried just to use IDT's address to link my ISR to the IDT :
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+2) = (flags>>8)&0xFF00;
*(Interrupt_Address+3) = (base>>16)&0xFFFF;
}
When I try to call the ISR33 : int $0x21, the software crashes : SingleStep CPU[1] Error : Processor Running.
So where is it wrong ???
Remark:
I use eclipse Heros(AT&T assembly), the code is in protected mode (CR0.PE = 1 I checked it, probably set by the BIOS).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已解决:),因为有一个 BIOS,它已经构建了 GDT/IDT,所以我找到了使用 sidt 和 sgdt 指令的地址,并将我的 ISR 添加到了 idt
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 idt