How knightmar/knightos works
KnightOS is a handcrafted x86 Rust kernel. Its documented workflow begins with a Multiboot boot, enters the kernel, initializes memory, interrupt hardware and task scheduling, then runs kernel tasks including graphics rendering; keyboard interrupts feed input into text state. The graph includes the documented boot capability, while source excerpts do not show the assembly-to-Rust handoff or how protected_main is reached, so those links are marked unverified. The README also documents cooperative scheduling, serial logging, memory management, graphics, text rendering and keyboard input.
Main entry points: kernel.rs Protected initialization · main.rs Kernel entry · helper.rs Graphics renderer · mod.rs Keyboard input
Components 16
Boot and kernel
- Multiboot boot
src/boot/boot.s - Kernel entry
src/main.rs - Protected initialization
src/kernel.rs
Hardware services
- GDT setup
src/backend/descriptors/gdt.rs - IDT and PIC
src/backend/descriptors/idt.rs - Interrupt handlers
src/backend/interrupts/mod.rs - Task scheduler
src/backend/multitasking/mod.rs - Serial logging
src/backend/serial/mod.rs
Memory management
- Paging
src/backend/paging/mod.rs - Physical allocator
src/backend/memory/pmm.rs - Virtual mapper
src/backend/memory/vmm.rs
User interface
- Graphics renderer
src/user_interface/graphics/helper.rs - Text state and font
src/user_interface/graphics/text.rs - Keyboard input
src/user_interface/input/mod.rs - Key translation
src/user_interface/utils.rs
Other components
- x86 hardware
Connections 15
- Multiboot boot → Kernel entry: hands off
- Kernel entry → GDT setup: loads GDT
src/main.rs - Kernel entry → Physical allocator: initializes bitmap
src/main.rs - Protected initialization → Paging: initializes paging
src/kernel.rs - Protected initialization → IDT and PIC: loads IDT, remaps PIC
src/kernel.rs - Protected initialization → Task scheduler: creates tasks, starts
src/kernel.rs - Protected initialization → Graphics renderer: schedules renderer
src/kernel.rs - Interrupt handlers → Task scheduler: switches task
src/backend/interrupts/mod.rs - Interrupt handlers → Keyboard input: dispatches scancode
src/backend/interrupts/mod.rs - Keyboard input → Key translation: translates scancode
src/user_interface/input/mod.rs - Keyboard input → Text state and font: adds character
src/user_interface/input/mod.rs - Graphics renderer → Virtual mapper: maps framebuffer
src/user_interface/graphics/helper.rs - Graphics renderer → Text state and font: looks up glyph
src/user_interface/graphics/helper.rs - Physical allocator → Paging: references directory
src/backend/memory/pmm.rs - x86 hardware → Interrupt handlers: raises interrupts