Boot
This document describes the Kyronix kernel boot process. It is the child of Kernel and parent of the Limine protocol reference.
Boot Sequence
The Kyronix kernel boots via the Limine v3 boot protocol. The bootloader loads the kernel ELF and provides the following information through Limine requests:
- Memory map (
LIMINE_MEMMAP_REQUEST) – Physical memory regions (usable, reserved, ACPI, framebuffer) - HHDM offset (
LIMINE_HHDM_REQUEST) – Higher Half Direct Map base address - Framebuffer (
LIMINE_FRAMEBUFFER_REQUEST) – Linear framebuffer for early display - Kernel address (
LIMINE_KERNEL_ADDRESS_REQUEST) – Physical and virtual base addresses - RSDP (
LIMINE_RSDP_REQUEST) – ACPI Root System Description Pointer - Modules (
LIMINE_MODULE_REQUEST) – Bootloader modules (initrd)
All requests use LIMINE_BASE_REVISION(3).
Boot Phases
Phase 1: Early Hardware (BSP)
serial_init(COM1)– Initialize serial port for debug outputgdt_init()– Set up Global Descriptor Table and Task State Segmentidt_init()– Set up Interrupt Descriptor Table, remap PIC to vectors 32-47kbd_init()– Initialize keyboard driver
Phase 2: Memory Setup
pmm_init()– Initialize physical memory manager from Limine memory mapvmm_init()– Enable NX bit, initialize kernel page tablesheap_init()– Initialize kernel heap allocator (64 KiB initial)
Phase 3: Per-CPU and SMP
- Write
MSR_GS_BASEandMSR_KERNEL_GS_BASEfor BSP per-CPU data smp_init()– Enumerate CPUs from Limine SMP response- SMEP detection and enable via CPUID leaf 7
syscall_init()– Configure SYSCALL/SYSRET MSRs, enable SSE
Phase 4: Device Drivers
pci_enumerate()– Scan PCI busacpi_init()– Parse ACPI tables from RSDPahci_init()– Initialize SATA/AHCI controllersvirtnet_init()– Initialize VirtIO network devicenet_init()– Initialize lwIP network stack
Phase 5: Timer and Scheduling
pit_init()– Program PIT channel 0 at ~250 Hzlapic_calibrate_timer()– Calibrate LAPIC timer against PIT- Create BSP idle process
smp_boot_aps()– Wake Application Processors
Phase 6: Filesystem and Init
ext2_init()– Register ext2 filesystem driver- Mount root filesystem from disk or load initrd via CPIO
process_exec("/init")– Load and execute init process
AP Boot Sequence
Application Processors are woken via the Limine SMP goto_address trampoline (ap_trampoline in kernel/proc/ap_trampoline.S). Each AP:
- Loads its
cpu_local_tfromlimine_smp_info.extra_argument - Loads the idle process kernel stack
- Calls
ap_init_cpu()which initializes GDT, IDT, MSRs, SSE, SYSCALL, LAPIC - Spins on
g_kernel_readyuntil BSP signals completion - Starts 250 Hz LAPIC periodic timer
- Enters
ap_sched_loop()(idle/scheduling loop)
Status Output
During boot, each initialization step prints a status line:
* Initialising PMM ... [ ok ]
* Initialising VMM ... [ ok ]
The [ ok ] / [ !! ] indicator is right-aligned at column 72 using ANSI escape codes.
Last reviewed: 2026-07-22