_kernel64_start, the CPU will fault. This page describes each requirement, explains what you must pass at the entry point, and shows how any x86_64 bootloader capable of loading an ELF64 image can satisfy all three.
Kernel Binary Details
Load the MVH Kernel ELF64 image with your bootloader’s standard ELF loader, then resolve the
_kernel64_start symbol from the ELF header to find the entry address. Do not hard-code a load address — always read it from the ELF program headers.
Requirements
1
x86_64 Long Mode
The CPU must already be running in 64-bit Long Mode (IA-32e mode) before you call the kernel entry point. This means:
- A valid Global Descriptor Table (GDT) is loaded with a 64-bit code segment.
- The CPU is executing with CS pointing to that 64-bit code segment descriptor.
CR0.PE(Protected Mode Enable) andCR0.PG(Paging) are both set.EFER.LMEandEFER.LMAare both set.
2
Identity-Mapped First GiB
The first 1 024 MiB (1 GiB) of physical memory must be identity-mapped in the active page tables before you enter the kernel. An identity map means that for every physical address
P in [0, 1 GiB), the virtual address P must resolve to physical address P.MVH Kernel’s PMM and VMM initialisation code accesses its own data structures through virtual addresses that equal their physical addresses. If the identity map is absent or incomplete, the very first kernel memory access will page-fault before the kernel has had a chance to install its own page tables.You may map the first GiB as a single 1 GiB huge page, as 512 × 2 MiB large pages, or as 262 144 × 4 KiB pages — the kernel does not require any particular granularity. After VMM initialisation the kernel rebuilds the page tables under its own control; your bootloader mappings only need to survive until vmm_init completes.3
Boot Memory Size in KiB
You must supply the total usable physical RAM in KiB to the kernel. The PMM’s
pmm_init function receives this value as its first argument (uint64_t memory_kib) and uses it to size the page-frame bitmap. If you pass zero, the PMM will mark no pages as available and every subsequent pmm_alloc_pages call will fail, causing the kernel to panic during heap or VMM initialisation.How you deliver this value depends on your bootloader protocol — see the example below.Passing the Memory Size
The mechanism for passingmemory_kib to the kernel depends on your bootloader protocol. The examples below show two common approaches.
Always derive
memory_kib from your bootloader’s memory map rather than from a hard-coded constant. The PMM uses this value to size internal structures; an under-count wastes physical RAM, and an over-count can cause the PMM to mark non-existent or reserved pages as available.What the Kernel Initialises After Entry
Once your bootloader transfers control to_kernel64_start with all three requirements met, MVH Kernel performs the following initialisation sequence automatically — you do not need to call any of these steps yourself:
- HAL — initialises platform hardware (VGA, serial, PS/2, PCI, RTC, PIT).
- PMM — builds the physical page-frame bitmap from
memory_kib. - VMM — installs the kernel page tables with security protections.
- Kernel Heap — initialises the 1 MiB coalescing heap.
- Kernel Log — starts the structured ring log.
- VFS + RAMFS — mounts the volatile RAM filesystem as root.
- Device Manager — registers all built-in drivers.
- Interrupt Layer — loads the IDT, remaps the 8259 PIC, and starts the 100 Hz PIT.
- Interactive Shell — enters the command loop and waits for keyboard input.