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).
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