Architectural decision
Aurora OS uses a hybrid kernel: monolithic core with modular loadable services.Options evaluated
- Monolithic kernel
- Microkernel
- Hybrid (chosen)
Pros:
- Fast syscalls (no IPC overhead)
- Simpler design
- Proven approach (Linux, SerenityOS)
- Single address space for kernel = one bug crashes everything
- Harder to isolate drivers
Rationale
- Performance: Hot paths (context switch, syscall, memory allocation) stay in-kernel (~100ns syscall overhead vs. ~10μs with IPC)
- Security: Loadable modules are signed with RSA-2048 and validated before loading
- Modularity: Drivers can be updated independently without kernel rebuild
- Agent isolation: Agent runtime in userspace with capability-based sandboxing
- Dual-target: Pure computation modules compile to WASM; hardware-dependent code stays native
kernel/src/, references in docs/arch.md
Kernel components
Boot sequence
Aurora OS boots via the Limine bootloader:Bootloader (Limine)
Loads kernel ELF, sets up higher-half mapping, enters 64-bit long modeConfig:
bootloader/legacy/limine.cfgKernel entry (kernel_main)
GDT/IDT setup, PIC/PIT initialization, framebuffer consoleImplementation:
kernel/src/main.c:42Memory management
Aurora OS implements a three-tier memory management system:Physical memory allocator (PMM)
Physical memory allocator (PMM)
Design: Bitmap-based allocator tracking 4 KiB framesFeatures:
- Memory-map aware (respects firmware-provided map)
- Reserves kernel image and bootloader data
- O(n) allocation (scans bitmap)
- O(1) deallocation (clears bit)
kernel/src/mm/pmm.cVirtual memory manager (VMM)
Virtual memory manager (VMM)
Design: 4-level paging (PML4 → PDPT → PD → PT)Features:
- Higher-half kernel mapping (kernel at 0xFFFFFFFF80000000)
- Per-process page tables
- Copy-on-write for fork()
- NX bit enforcement (stack/heap non-executable)
- ASLR with random offset
kernel/src/mm/vmm.cHeap allocator (kmalloc)
Heap allocator (kmalloc)
Design: Free-list allocator with slab cachesFeatures:
- Slab caches for 16, 32, 64, 128, 256 byte allocations
- Free-list for larger allocations
- Debug mode: fill freed memory with 0xDEADBEEF
- Alignment support (16-byte aligned by default)
kernel/src/mm/heap.cProcess scheduling
Aurora OS implements a CFS-inspired (Completely Fair Scheduler) preemptive scheduler:- Fairness: Each task accumulates
vruntimebased on CPU time used - Priority weights: Higher priority = slower vruntime accumulation
- Preemption: Timer interrupt (1000 Hz) triggers scheduler
- Context switch: ~2μs to save/restore registers and switch page tables
kernel/src/proc/sched.c, kernel/arch/x86_64/context.S
Syscall interface
Aurora OS uses the fastSYSCALL/SYSRET instructions (x86_64):
RAX= syscall numberRDI,RSI,RDX,R10,R8,R9= arguments (up to 6)- Return value in
RAX(negative = error)
- Process:
exit,fork,execve,waitpid,getpid,kill - File:
open,close,read,write,stat,mkdir,unlink - Memory:
mmap,munmap,brk - IPC:
msgsnd,msgrcv,shmget,shmat,shmdt - Network:
socket,bind,connect,send,recv
Virtual file system
The VFS provides a unified interface for all file systems:kernel/src/fs/vfs.c, kernel/src/fs/tmpfs.c
Hardware abstraction layer
The HAL provides portability across x86_64 and ARM:kernel/arch/x86_64/— x86_64 assembly, GDT/IDT, APIC, syscall entrykernel/arch/aarch64/— ARM64 assembly, exception vectors (planned)
kernel/src/hal.c, kernel/arch/*/
Security features
KASLR
Kernel Address Space Layout Randomization: kernel loaded at random offsetImplementation:
kernel/kernel.ld:8 (random base address)ASLR
User-space address randomization: stack, heap, libraries at random offsetsImplementation:
kernel/src/proc/exec.c:180Stack canaries
GCC
-fstack-protector-strong detects buffer overflowsCompiler flags: Makefile:25NX bit
Non-executable stack and heap pages prevent code injectionImplementation:
kernel/src/mm/vmm.c:95 (PTE_NX flag)Capability tokens
256-bit random tokens for IPC authorization (prevents PID guessing)Implementation:
rust/caps/src/lib.rsModule signing
RSA-2048 signatures on loadable modules (prevents malicious drivers)Implementation:
kernel/src/module/verify.cCurrent status
- Implemented
- In progress
- Planned
✅ Boots via Limine on x86_64 (UEFI + BIOS)
✅ GOP framebuffer console with VGA fallback
✅ GDT, IDT, PIC, PIT timer (1000 Hz)
✅ Physical memory allocator (bitmap)
✅ 4-level paging with higher-half mapping
✅ Heap allocator (free-list + slab caches)
✅ Process model with fork, exit, waitpid
✅ CFS-inspired preemptive scheduler
✅ SYSCALL/SYSRET with 38 handlers
✅ VFS with tmpfs mounted at boot
✅ ELF loader with per-process page tables
✅ TCP/UDP/IP network stack
✅ Signal delivery with user handlers
✅ COW page fault handler
✅ KASLR + ASLR
✅ IPC message passing with capability tokens
✅ HAL for x86_64/ARM portability
References
- OSDev Wiki — Microkernel
- OSDev Wiki — Monolithic Kernel
- SerenityOS — Monolithic with loadable modules
- Redox OS — Microkernel in Rust
- Linux kernel documentation
Next steps
System calls
Explore the syscall API reference
Memory management
Deep dive into memory subsystem APIs
Building
Build the kernel from source
Testing
Run kernel tests in QEMU