Я работаю на плате N450, оказалось, что у нее уже есть IDT (возможно, встроенная в BIOS !!).
Когда я вызываю свой ISR, используя INT $ 0x55 (используя ItnCall), код переходит на другой случайный адрес вместо перехода на ISR_0x55 !!!, почему?
это мой код:
код C
fill_interrupt(ISR_0x55,
(unsigned int) isr0x55, //
0x10, // Segment Selector
0x8E); // P=1, DPL=0, D=1
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;
}
Код сборки
IntCall:
push %ebp //save the context to swith back
movl %esp,%ebp
//debug only
nop
nop
//debug only
int $0x55
pop %ebp //Return to the calling function
ret