Keyboard interrupts
I am studying low-level device driver stuff. I am confused between interrupts and IRQ. A sample driver code that hooks keyboard suggests keyboard interrupt is 0x31 but my book on microprocessor says it is 0x09. On opening 'De开发者_如何转开发vice Manager->Keyboards->Resources', it shows IRQ is 1. Can anyone clarify this?
Thanks, Sanjeev
It's like this. In your computer you have a unit called the (A)PIC. This unit takes input from some of your perpipheral devices, like the PS2 keyboard, and raises an interrupt on the CPU. In a modern system there are two APICs. One is called the primary and the other one is called the slave and each hold 8 IRQ lines. When you press a key on the keyboard the APIC gets a signal on line 1 (IRQ 1) which then causes an interrupt to occur on the CPU.
The APIC can be programmed so even if it recieves a signal on line 1 it will not raise interrupt 9 on the CPU (even though weirdly this actually is the default if you do not program it) because that would conflict with some of the CPUs internal interrupts so you usually program it to go somewhere else. In your case it seems like it translates it to interrupt 0x31 which sounds like it could be correct (it adds IRQ + 0x30).
I strongly don't believe it is mapped to interrupt 9 because that would conflict with the Double Fault exception interrupt for the processor, the book probably just mention the default setting.
The simple answer is that an IRQ (Interrupt ReQuest) is a hardware input which is mapped by the system to an interrupt. In the case of the keyboard IRQ1 is mapped to interrupt 9.
The happy answer is that interrupt 31h in this context is obviously an error or typo.
Interrupt request
精彩评论