Page 1 of 1

I/O APIC Keyboard IRQ1 keeps firing

Posted: Sat Jun 05, 2010 3:21 pm
by mehcode
Hello Everyone,

I'm attempting to switch from using the legacy PIC to the fancy I/O APIC and right now I've got the LAPIC set up correctly with the timer interrupt firing properly. However, when I set up the I/O APIC to fire IRQ1 for the keyboard I get hundreds of IRQ1s. They just keep coming. :lol:

To setup the I/O APIC for IRQ1 I set the table entry #1 (0x12 - 0x13 offset) to 0x0000000000000021.

Anyway, is there some EOI register on the I/O APIC ?

Code: Select all

void __declspec(naked) KBDHandler()
{
        __asm pushad;
        __asm cli;

        scancode = inportb(0x60);

        kprintf("%X", scancode); // Print scancode

        (*(dword*)(g_LAPIC_Base + 0x0B)) = 0; // Send EOI

        __asm sti;
        __asm popad;
        __asm iretd;
}
When I set up the IRQ1 through the PIC I only got an interrupt when I actually pressed a key. Weird. Any help is appreciated. Thanks.

Re: I/O APIC Keyboard IRQ1 keeps firing

Posted: Sat Jun 05, 2010 5:05 pm
by mehcode
Nevermind :oops:

My functions for reading / writing the I/O APIC registers were messing up and causing me to initialize the timer IRQ as the keyboard IRQ. :)

Basically I have a read / write functions for I/O APIC so that I can just pass in the GSI# (global system interrupt #) and then the function will figure out which I/O APIC to read from so the rest of my OS can just think there is one I/O APIC. It works now. :)

Now on to my .. hmm I guess .. VGA. That sounds fun.

I spent a few hours trying to find this bug and shortly after I registerd and asked here I found it. meh. oh well. must be this board's good luck :lol: