Why my keyboard handler works only once ?
Posted: Thu Apr 09, 2009 11:27 am
I'm trying to handle my interrupt and so far I'm only trying to set basis up but my keyboard interrupt works only once (or sometimes doesn't work at all...).
Timer interrupt keeps on working well and I print every second "clock"
Here's my code... I wrote this according to what i found in the wiki about interrupt..
How i initiate IDT
How it's handle in asm
extern isr_default_int, isr_clock_int, isr_kbd_int
global _asm_default_int, _asm_irq_0, _asm_irq_1
and in C
When i execute, i can print "keyboard" only once, "clock" keeps on working.
Could someone explain to me why the keyboard handler works only once ?
Thank you.
Timer interrupt keeps on working well and I print every second "clock"
Here's my code... I wrote this according to what i found in the wiki about interrupt..
How i initiate IDT
Code: Select all
for (i = 0; i < IDTSIZE; i++)
create_idt_seg_desc(0x08, (u32) _asm_default_int, INTGATE, &IDT[i]);
create_idt_seg_desc(0x08, (u32) _asm_irq_0, INTGATE, &IDT[32]); /* timer*/
create_idt_seg_desc(0x08, (u32) _asm_irq_1, INTGATE, &IDT[33]); /* keyboard*/
How it's handle in asm
extern isr_default_int, isr_clock_int, isr_kbd_int
global _asm_default_int, _asm_irq_0, _asm_irq_1
Code: Select all
_asm_default_int:
call isr_default_int
mov al,0x20
out 0x20,al
iret
_asm_irq_0:
call isr_clock_int
mov al,0x20
out 0x20,al
iret
_asm_irq_1:
call isr_kbd_int
mov al,0x20
out 0x20,al
iret
and in C
Code: Select all
void isr_default_int(void)
{ print ("unknown interupt"); }
void isr_clock_int(void)
{ static int tic = 0;
tic++;
if (tic % 100 == 0) {
tic = 0;
rint("clock ");
}
}
void isr_kbd_int(void)
{ print("keyboard"); }
Could someone explain to me why the keyboard handler works only once ?
Thank you.