Layer Stack
The table below lists each layer in bottom-up order together with its primary role and key parameters.HAL
The HAL initialises the platform and exposes a uniform API for keyboard input (hal_keyboard_read), wall-clock time (hal_clock_read), PCI device enumeration (hal_pci_scan), tick counter (hal_ticks), uptime (hal_uptime_seconds), and a hard reboot (hal_reboot). All hardware-specific details — port I/O addresses, CMOS register layout, PIC wiring — are contained within the HAL and hidden from every layer above.
Physical Page Allocator (PMM)
The PMM tracks physical RAM as 4 KiB pages. It initialises from the boot-supplied memory size (in KiB) and marks the kernel image as reserved. The identity map covers the first 1 024 MiB of physical address space. You allocate one or more contiguous pages withpmm_alloc_pages and release them with pmm_free_pages. The PMM exposes statistics — total, used, free, and reserved page counts together with allocation request, failure, and peak-usage counters — via pmm_get_stats.
Virtual Memory Manager (VMM)
The VMM implements x86_64 four-level paging. It dynamically maps and unmaps individual 4 KiB pages withvmm_map_page and vmm_unmap_page using a rich set of page-attribute flags. Security protections — supervisor write-protect, NX enforcement, null-page guard, and (where the CPU supports them) SMEP, SMAP, and UMIP — are applied during VMM initialisation. Kernel text pages are mapped read-only and executable; kernel data pages are mapped writable and non-executable.
Kernel Heap
The 1 MiB coalescing heap provideskmalloc / kfree for dynamic kernel allocations. Every block carries a canary value; a corrupted canary triggers an immediate kernel panic. Freed memory is poisoned to catch use-after-free bugs at the point of the next access. Invalid double-frees and bad-pointer frees are counted and reported in heap statistics.
VFS and RAMFS
The Virtual Filesystem provides a uniform path-based API (vfs_chdir, vfs_list, vfs_mkdir, vfs_touch, vfs_write, vfs_read, vfs_remove) backed by a volatile RAM filesystem mounted at the root. All filesystem state is lost when the kernel reboots.
Device Manager
The device manager holds a registry of up to 32 kernel-managed devices. Each entry records a numeric ID, a device type (CPU, interrupt controller, timer, input, display, serial, clock, bus, or filesystem), an online flag, and a name of up to 27 characters. You register devices withdevice_register and enumerate them with device_list.
Task Registry
The task registry tracks up to 16 kernel tasks. Each entry stores a PID, a priority byte, a lifecycle state (UNUSED, RUNNING, READY, SLEEPING, or STOPPED), a creation tick, and a name. The registry is inspectable at runtime through the shell.
Interrupt Layer
interrupt_init loads the IDT and remaps the 8259 PIC so hardware IRQs start above the CPU exception vectors. The PIT is programmed to fire at 100 Hz, providing the kernel’s time base. Every vector maintains a fire counter accessible via interrupt_count; interrupt_total and interrupt_spurious_count give system-wide totals.
Kernel Log
The kernel log is a 16 KiB ring buffer. Each write carries a log level, an optional category string, and the message text. The ring wraps when full, discarding the oldest entries. Console mirroring can be toggled withklog_set_console. The full log content can be read back with klog_copy.
Kernel Panic
When the kernel encounters an unrecoverable condition it callskernel_panic (software panic) or kernel_panic_exception (hardware exception). Both paths dump all general-purpose registers (RAX–R15), the exception vector, error code, RIP, CS, and RFLAGS, then decode any recognised error flags and print a stack trace before halting.
Interactive Shell
The shell provides more than 50 built-in commands that cover every layer described above — memory statistics, page mapping queries, device listing, task inspection, filesystem operations, PCI enumeration, CPU diagnostics, log dumping, and more. See the Shell Overview for the full command reference.Drivers
MVH Kernel ships the following drivers, registered with the device manager at boot:Current Scope and Limitations
MVH Kernel 1.1.2 targets a single-processor, kernel-mode environment. The following capabilities are explicitly out of scope for this release:- Single boot processor only — symmetric multiprocessing (SMP) is not supported.
- Kernel mode only — there is no userspace ELF loader and no privilege-level separation between user and kernel (ring 3 is unused).
- Volatile root filesystem — RAMFS contents do not persist across reboots.
- Legacy PIC — the APIC is detected but not used; the 8259 PIC remains active.
- No ACPI boot-table handoff — ACPI tables are not parsed.
- Temperature monitoring — limited to supported Intel DTS and AMD family parts.
- No compiler stack protector — kernel code is built without
-fstack-protector. - No network, USB, or storage stack — peripheral buses beyond PCI configuration space are not managed.