0
votes

For an operating system project I am trying to implement interrupts in x86 system. I am preparing interrupt descriptor table and loading. For demonstration purposes, I am working on keyboard interrupts. Interrupt Handler for keyboard works however only once. What may be the problem and how can I solve it? Thanks in advance.

Edit:

I am using the same code as in the link below. (Sample Code)

Keyboard IRQ within an x86 kernel

EDIT: This topic can be closed, problem is now solved. I needed to read keycode port only not act according to status port.

1
Post your code. Crystal balls do not make useful remote debuggers. - Andrew Henle
Do you have any piece of code that demonstrates us what you have tried so far. (Or else this question will be closed). - Laurent LAPORTE

1 Answers

0
votes

Almost certainly, this:

 status = read_port(0x64);
 /* Lowest bit of status will be set if buffer is not empty */
 if (status & 0x01) {

should be ~ this :

 while ((status = read_port(0x64)) & 1) {
 /* Lowest bit of status will be set if buffer is not empty */

To clear the device interrupt. The original PC/AT integrated devices are edge triggered only, so you have to ensure that the source of interrupt is cleared before exiting the interrupt handler.