Page 1 of 1

Keyboard Interrupt only works manually not on press

Posted: Sat Jun 15, 2024 12:30 am
by CrossScar
When I tried to implement my keyboard interrupt it wouldn't get called even though it works when ran manually. I've tried calling

Code: Select all

inportb(0x60)
to clear the buffer but that doesn't work either. Can't figure out what to do. Here is my code. Sorry about the messy code, the keyboard driver is currently split between

Code: Select all

src/kernel.cpp
and

Code: Select all

src/keyboard/keyboard.c
for testing and interrupts are in the

Code: Select all

src/interrupts folder
.

Re: Keyboard Interrupt only works manually not on press

Posted: Sat Jun 15, 2024 1:44 pm
by Octocontrabass
You need to set up a GDT before you can set up your IDT. Multiboot does not guarantee a usable GDT.

You mask all the IRQs and never unmask IRQ1.

You install your keyboard handler on IRQ3.

There may be other problems, this is just what I spotted after looking for a few minutes.

Re: Keyboard Interrupt only works manually not on press

Posted: Thu Jun 20, 2024 9:57 am
by CrossScar
Thank you I fixed it with unmasking and switching to IRQ 1. I didn't need to setup the GDT but I've been needing to for a while. I can't seem to figure out how to do it correctly.

Re: Keyboard Interrupt only works manually not on press

Posted: Thu Jun 20, 2024 7:28 pm
by Octocontrabass
If you'd like help with setting up the GDT, tell us more about what you've tried so far.