What is the valid IDT descriptor for hardware interrupts?
Posted: Sat Jun 20, 2020 1:23 pm
I have set_intr_gate function to set some interrupts. In general, I predicted three functions: set_intr_gate, set_trap_gate and set_system_gate. set_intr_gate looks like this:
When I use this function to set the interrupt like below it works:
But when I try to set a hardware interrupt like this:
This results in the processor halt after pressing any key. Of course irq1 is not called what I checked in GDB.
Code: Select all
void set_intr_gate(s32int n,void *addr)
{
idt[n].offset_low = (u64int) addr & 0xFFFF;
idt[n].selector = 8;
idt[n].ist = 0;
idt[n].type_attr = 142;
idt[n].offset_middle = ( (u64int) addr & 0xFFFF0000) >> 16;
idt[n].offset_high = ( (u64int) addr & 0xFFFFFFFF00000000) >> 32;
idt[n].zero = 0;
}
Code: Select all
extern void int_handler(void);
set_system_gate(49, &int_handler);
asm("int $49");
Code: Select all
set_intr_gate(0x21, &irq1); //irq1
enable_irq(1);