Master the fundamental concepts of build a mini kernel through this focused micro-challenge.
Keyboards send scancode bytes on IRQ1 from the 8042 controller. Make/break codes map through translation tables to ASCII for simple text mode shells.
Read path:
0x640x60For example, scancode 0x1E press with shift held may yield uppercase A in your lookup table.
The PS/2 scan-code translation you implement here , make codes, break codes, the shift/caps-lock XOR trick , is exactly what every BIOS and early Linux console driver did before USB HID keyboards became standard. Confusing a break code for a make code is a classic bug that makes a kernel think a key is still held down forever after it's released.
Before you call the implementation done, walk failure modes on purpose. Test empty structures, single-element edge cases, maximum concurrency, and errno paths that must not crash the program. OS code usually fails in production when happy-path tests pass but invariants break under contention or memory pressure.
Keep structures small and name fields after kernel counterparts when possible. That lets you read man pages and kernel source side by side while you work. Print observable events during development; remove noisy logs once tests pass reliably.
You will handle IRQ1, maintain modifier state, and push translated characters into a ring buffer. The task asks you to ignore break codes without duplicating key events.
Implement a PS/2 keyboard driver simulation in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github