How manvesh2011/rust-os-starter works
rust-os-starter is a minimal no_std AArch64 kernel for QEMU’s virt machine. Its boot path initializes interrupt handling and memory translation, probes the optional VirtIO block device, starts kernel threads, then relies on timer-driven preemption; UART reports output and receives input. The runtime also exposes an SVC interface for user processes, memory allocation, and IPC, with user mappings checked by usercopy. The README documents additional capability control and hardware support; sampled excerpts do not show all their wiring, so uncertain links are omitted.
Main entry points: main.rs Kernel entry · syscall.rs SVC dispatcher · process.rs Process manager · scheduler.rs Thread scheduler
Components 19
Boot and platform
- Kernel entry
kernel/src/main.rs - Boot information
kernel/src/bootinfo.rs - Platform map
kernel/src/memmap.rs - Exception vectors
kernel/src/exceptions.rs - GICv2 controller
kernel/src/gic.rs - Generic timer
kernel/src/timer.rs
Execution and syscalls
- Thread scheduler
kernel/src/scheduler.rs - Process manager
kernel/src/process.rs - SVC dispatcher
kernel/src/syscall.rs - IPC queue
kernel/src/ipc.rs - Capability access
kernel/src/capability.rs
Memory and protection
- MMU and page tables
kernel/src/mmu.rs - Page allocator
kernel/src/memory.rs - Bump heap
kernel/src/heap.rs - User-pointer checks
kernel/src/usercopy.rs - Spin mutex
kernel/src/sync.rs
Devices and communication
- PL011 UART
kernel/src/uart.rs - VirtIO block driver
kernel/src/virtio_blk.rs
Other components
- QEMU virt
Connections 23
- QEMU virt → Kernel entry: loads kernel
- Kernel entry → Exception vectors: installs vectors
- Kernel entry → GICv2 controller: initializes
- Kernel entry → MMU and page tables: enables mapping
- Kernel entry → VirtIO block driver: probes device
- Kernel entry → Thread scheduler: spawns threads
- Kernel entry → PL011 UART: prints boot status
- Exception vectors → SVC dispatcher: dispatches SVC
- Exception vectors → Thread scheduler: schedules IRQ
- Exception vectors → GICv2 controller: acknowledges IRQ
- GICv2 controller → Generic timer: routes timer IRQ
- GICv2 controller → PL011 UART: routes RX IRQ
- Thread scheduler → Process manager: tracks current PID
- Process manager → Thread scheduler: creates thread
- Process manager → Page allocator: allocates process pages
- Process manager → MMU and page tables: switches user table
- SVC dispatcher → Thread scheduler: yields thread
- SVC dispatcher → Page allocator: allocates or frees
- SVC dispatcher → IPC queue: sends or receives
- SVC dispatcher → PL011 UART: writes byte
- User-pointer checks → Process manager: gets user table
- User-pointer checks → MMU and page tables: checks mappings
- QEMU virt → VirtIO block driver: provides block device