我在 Atom-32bit-intel 上工作,我必须移植 MicroC OS II,所以没有代码可以在 Atom 上进行任何配置(没有 GDT,没有 LDT ...):
我的问题更多是关于重置后 Atom-32bit 的状态,Atom 是否处于保护模式?最重要的是我如何检查它是哪种模式(必须检查哪些寄存器以及如何检查)?
备注:CR0.PE = 1(我检查过),这足以证明 Atom 处于保护模式吗?
* ** * ** * ** * **更新 :** * ** * ** * ** * ** * **
/*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+1) = (flags>>8)&0xFF00;
*(Interrupt_Address+1) = (base>>16)&0xFFFF;
}
我的 ISR 是一个简单的 ISR:
isr33:
nop
nop
cli
push %ebp //save the context to swith back
mov %esp,%ebp
pop %ebp //Return to the calling function
sti
ret