How sagi21805/learnixos works
LearnixOS is an educational Rust operating system. Its visible boot workflow starts in the first-stage bootloader, which loads the second stage and kernel, gathers the BIOS memory map, and transfers control; the kernel then initializes memory and interrupts, sets up interactive console input, reports PCI and CPU information, and enters its console loop. The repository also contains x86 primitives, memory allocators, device drivers, and shared support crates. The second-stage-to-kernel handoff and several subsystem internals are not evidenced by the sampled source, so those links are omitted.
Main entry points: src/main.rs Kernel Entry · lib.rs Slab Allocator · global_descriptor_table.rs Global Descriptor Table · src/main.rs First Stage
Components 29
Boot
- First Stage
bootloader/first_stage/src/main.rs - Disk Loading
bootloader/first_stage/src/disk.rs - Second Stage
bootloader/second_stage/src/main.rs
Kernel
- Kernel Entry
kernel/src/main.rs - Memory Setup
kernel/src/memory.rs - Interrupt Setup
kernel/src/idt/mod.rs - Exception Handlers
kernel/src/idt/exceptions.rs - Console Loop
kernel/src/console.rs - Timer
kernel/src/timer.rs
x86 Platform
- CPU Instructions
crates/arch/x86/src/instructions/port.rs - Memory Map
crates/arch/x86/src/memory_map.rs - Global Descriptor Table
crates/arch/x86/src/structures/global_descriptor_table.rs - Interrupt Descriptor Table
crates/arch/x86/src/structures/interrupt_descriptor_table.rs - Segment Structures
crates/arch/x86/src/structures/segments.rs
Memory
- Bitmap
crates/common/src/bitmap.rs - Page Allocator
crates/memory/page/src/arena.rs - Buddy Allocator
crates/memory/buddy/src/lib.rs - Buddy Metadata
crates/memory/buddy/src/meta.rs - Slab Allocator
crates/memory/slab/src/lib.rs - Slab Cache
crates/memory/slab/src/cache.rs - Slab Descriptor
crates/memory/slab/src/descriptor.rs
Devices And Support
- Address Types
crates/common/src/address_types.rs - Keyboard Driver
crates/drivers/keyboard/src/lib.rs - VGA Display
crates/drivers/vga-display/src/console.rs - PCI Scanner
crates/drivers/pci/src/lib.rs - AHCI Driver
crates/drivers/ahci/src/hba.rs - Bitfield Macro
crates/macros/bitfields/src/bitfields.rs - Synchronization
crates/sync/src/rwlock.rs
Other components
- BIOS
Connections 21
- BIOS → First Stage: starts
bootloader/first_stage/src/main.rs - First Stage → Disk Loading: loads from
bootloader/first_stage/src/main.rs - First Stage → Second Stage: jumps to
bootloader/first_stage/src/main.rs - Kernel Entry → Memory Setup: initializes
kernel/src/main.rs - Kernel Entry → Interrupt Setup: initializes
kernel/src/main.rs - Interrupt Setup → Exception Handlers: uses handlers
- Kernel Entry → Console Loop: runs
kernel/src/main.rs - Kernel Entry → PCI Scanner: scans
kernel/src/main.rs - Kernel Entry → CPU Instructions: queries CPU
kernel/src/main.rs - Global Descriptor Table → CPU Instructions: loads with
crates/arch/x86/src/structures/global_descriptor_table.rs - Global Descriptor Table → Segment Structures: uses selectors
crates/arch/x86/src/structures/global_descriptor_table.rs - Memory Map → Address Types: uses address types
crates/common/src/address_types.rs - Bitmap → Address Types: uses addresses
crates/common/src/bitmap.rs - Buddy Allocator → Buddy Metadata: organizes blocks
crates/memory/buddy/src/lib.rs - Slab Allocator → Buddy Allocator: requests pages
crates/memory/slab/src/lib.rs - Slab Allocator → Slab Cache: allocates through
crates/memory/slab/src/lib.rs - Slab Allocator → Slab Descriptor: creates
crates/memory/slab/src/lib.rs - Console Loop → Keyboard Driver: initializes input
- Console Loop → VGA Display: writes display
- Global Descriptor Table → Bitfield Macro: uses generated fields
crates/arch/x86/src/structures/global_descriptor_table.rs - Slab Allocator → Synchronization: uses locking