Overview
Ok so we actually survived it to KFS_4, this is a huge achievement!
Now we get to work with interrupts properly! We already had some interrupt stuff handled from KFS_1:
- IDT created, filled and registered
- Hardware interrupts (keyboard)
- Exception handlers (divide by zero, Page Fault, Global Panic Faults etc)
What we needed to implement for KFS_4:
- Signal-callback system — a way to register custom handlers for interrupts at runtime
- Interface to schedule signals
InterruptFrame— capturing full CPU state on interrupt- Register cleaning before panic/halt
- Stack saving before panic
- Bonus: syscall base, get_line foundation, keyboard layouts (QWERTY/QWERTZ/AZERTY)
The biggest pieces were the signal-callback system and stack-saving. The signal
callback system is the foundation everything else builds on — without it, handlers are
hardcoded forever and processes can never register their own signal handlers. The
InterruptFrame is what makes proper panic output and future context switching possible.
What Ive Built
Mandatory:
- Signal table — 256 function pointer slots, swappable at runtime via
register() - Generic dispatcher — all interrupts flow through one assembly stub →
rust_interrupt_dispatcher - Signal scheduling queue — ring buffer,
schedule()andprocess_pending() InterruptFrame— captures full CPU state (registers + CPU-pushed eip/cs/eflags)capture_registers()— snapshots current CPU state for software panicsclear_registers()— XOR zeroes all general purpose registers before halt- Stack dump — prints 8 words around ESP on panic
- Proper
kernel_panic— message + register dump + stack dump + register clear + halt
Bonus:
- Keyboard layouts — QWERTY, QWERTZ, AZERTY with runtime switching via
sys kb get_linefoundation — infrastructure in place, blocked on KFS_5 scheduler- Syscall base —
int 0x80handler, dispatch table,sys_write/sys_read/sys_exitstubs