I load my idt via LIDT instruction put an interrupt on int 0x31 call it, it works but when i put an interrupt on my kbd interrupt nothing happens when i touch the keys KBD interrupt 0x21 i remaped the pics to 0x20,0x28 heres my code:
[section .text]
[extern GDT_KERN_CODE]
[Global _Load_IDT]
[Global _Addint]
_Load_IDT:
lidt [idt_pointer]
ret
_Addint:
mov edi,idt_start ;edi = idt
.1:
add edi, 8
loop .1
mov [edi],ax ;LOW byte
shr eax,16
add edi, 6
mov [edi],ax ;HIGH byte
ret
[section .data]
idt_start:
%rep (0Eh)
dw 0
dw GDT_KERN_CODE ;selector: 0x18
dw 8E00h ;Present, Priv0
dw 0
%endrep
dw 0
dw GDT_KERN_CODE ; selector: 0x18
dw 0E00h ; Priv0
dw 0
%rep (4h)
dw 0
dw GDT_KERN_CODE ;selector: 0x18
dw 8E00h ;Present, Priv0
dw 0
%endrep
%rep (0Bh)
dw 0
dw GDT_KERN_CODE ;selector: 0x18
dw 0E00h ; Priv0
dw 0
%endrep
%rep (0E0h)
dw 0
dw GDT_KERN_CODE ;selector: 0x18
dw 8E00h ;Present, Priv0
dw 0
%endrep
idt_end:
idt_pointer:
dw idt_end-idt_start-1
dd idt_start
PICs:
void init_PICs()
{
outportb(0x20, 0x11);
outportb(0xA0, 0x11);
outportb(0x21, 0x20);
outportb(0xA1, 0x28);
outportb(0x21, 0x04);
outportb(0xA1, 0x02);
outportb(0x21, 0x01);
outportb(0xA1, 0x01);
kprintf("Init_PICs:\n PIC1: 0x20\n PIC2: 0x28\n");
}
I'd Also like to know why this doesnt work
int Register_INT(void (*handler)(),int intn)
{
if(intn=15||intn>=20 && intn<=31)
return 1;
asm volatile(
"movl %0,%%eax \n"
"movl %1,%%ecx \n"
:
:"g"((dword)handler), "g"((dword) intn));
Addint();
return 0;
}
Any help is greatly apriciated.