0

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.

WhiteFlowers
  • 43
  • 10

1 Answers1

0

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.

mevets
  • 9,553
  • 19
  • 30