System Components
The kernel is organized into several major subsystems:Boot & Initialization
Stivale2 bootloader protocol, kernel entry point, and system initialization sequence
Memory Management
Physical Memory Manager (PMM) and Virtual Memory Manager (VMM) with paging support
Process Management
Task structures, scheduler, and multitasking implementation
Device Support
Framebuffer, serial port, and terminal drivers
Kernel Entry Point
The kernel begins execution inkmain() located in kernel/kmain.c:47. The initialization sequence follows a carefully ordered process:
kernel/kmain.c
Initialization Phases
The kernel initialization follows these phases:Phase 1: Core Initialization
- IDT Setup - Interrupt Descriptor Table initialization
- CPU Features - Detect and enable CPU features
- Memory Management - Initialize PMM and VMM
- GDT Setup - Global Descriptor Table initialization
Phase 2: Device Initialization
- Framebuffer - Initialize graphics output
- Serial Port - Enable serial communication
- Terminal - Set up terminal subsystem
Phase 3: System Services
- ACPI - Advanced Configuration and Power Interface
- HPET - High Precision Event Timer
- APIC - Advanced Programmable Interrupt Controller
- VFS - Virtual File System
- SMP - Symmetric Multiprocessing support
Phase 4: Multitasking
After reclaiming bootloader memory, the scheduler is initialized withkinit() as the first kernel task:
kernel/kmain.c
The
kmain() function never returns. After sched_init(), code should be placed in kinit() instead, as indicated by the comment in the source.Memory Layout
Aeolos uses a higher-half kernel design:- Higher Half Offset:
0xFFFFFFFF80000000- Kernel code and data mapped here - Physical Memory:
0xFFFF800000000000- All physical memory mapped to this virtual base - Page Size: 4096 bytes (4 KiB)
Design Philosophy
Modular Architecture
Modular Architecture
Each subsystem is self-contained with clear interfaces. Memory management, process management, and device drivers are cleanly separated.
Safety First
Safety First
The kernel converts bootloader-provided physical addresses to virtual addresses early to prevent issues when identity mapping is removed.
Resource Management
Resource Management
Bootloader memory is reclaimed after initialization. Dead tasks are cleaned up by a dedicated janitor task.
Key Constants
| Constant | Value | Description |
|---|---|---|
PAGE_SIZE | 4096 | Standard page size in bytes |
KSTACK_SIZE | 4096 | Kernel stack size per task |
TID_MAX | 65536 | Maximum number of tasks |
CPU_MAX | Varies | Maximum supported CPUs |
Next Steps
Boot Process
Learn about the Stivale2 boot protocol and kernel initialization
Memory Management
Explore PMM and VMM implementation details