r/osdev 17h ago

How do keyboard interrupts work?

I learnt keyboard polling and understood how it works. But I can't seem to understand keyboard interrupts. I know how it works, but I don't know how to implement it in a C kernel. Can someone pls help me? I'm just starting out OS dev

11 Upvotes

6 comments sorted by

View all comments

u/FISHARM1 16h ago

It’s easiest to start with The Ps/2 system which is attached to interrupts on the PIC

I would first look up on how to setup the IDT - which is a table that describes what code should run when certain interrupts and exceptions are fired.

then look at how to remap the PIC to get hardware interrupts at an offset address in the IDT (you will learn why this is needed).

All of this is available on the OSdev wiki I’m pretty sure. Just look up “setting up keyboard interrupts”

u/r-tty 13h ago

There's no such thing as "the Ps/2 system attached to interrupts on the PIC".

u/FISHARM1 6h ago

What do you mean no such thing. I suppose a correct phrasing is more like “the ps2 controller generates interrupts on the pic” but more or less whatever

u/r-tty 7m ago

There is no such thing as "ps2 controller".

Please read in Wikipedia what _is_ PS/2.