XNT
Back to Blog

Architecture Overview: CoreXNT Kernel

A look at the CoreXNT kernel architecture — boot sequencing, memory management, SMP initialization, and threading.

Boot Sequence

The boot process follows a standard path from power-on to the running kernel:

  1. BIOS/UEFI loads GRUB
  2. GRUB loads the kernel ELF
  3. boot.S sets up long mode with identity-mapped pages
  4. kernel_main() initializes subsystems

Memory Management

The kernel uses a physical memory manager (PMM) with bitmap allocation. The page table hierarchy follows standard x86_64 conventions:

PML4 → PDPT → PD → PT → 4 KB pages

Identity Map

The kernel is identity-mapped through boot.S's 2 MB huge pages. This mapping is crucial for early boot and remains available.

SMP (Symmetric Multiprocessing)

SMP initialization follows a careful protocol:

  1. BSP parses the ACPI MADT table to discover APIC IDs
  2. AP trampoline is copied to real-mode addressable memory
  3. Each AP transitions: real-mode → protected-mode → long mode
  4. Per-CPU structures are identified by APIC ID matching

Common Pitfall

CR4.PAE must be set before enabling paging. APs start with CR4=0 after INIT, making this a frequent source of bugs during bring-up.

Thread Scheduling

The scheduler implements round-robin across all threads:

  • User threads are preempted by the PIT timer
  • Kernel threads are cooperative and must yield explicitly

Security Features

  • ASLR — Address Space Layout Randomization for user processes (XORShift64 PRNG seeded from RDTSC + entropy)
  • KASLR — Kernel Address Space Layout Randomization (post-boot relocation using --emit-relocs ELF extraction)
  • Process isolation — separate address spaces with hardware protection
  • Seccomp — security filtering
  • Signed kernel modules — cryptographic verification
  • Null-deref protection — user-mode null deref kills the process, not the system

Driver Subsystems

The kernel includes drivers for:

  • Storage: NVMe, AHCI (SATA), Virtio-blk
  • USB: xHCI controller, HID keyboard/mouse, storage, hub
  • Networking: Virtio-net
  • Bus: PCI
  • Video: Framebuffer, VGA

Filesystem Support

Multiple filesystems are supported via a VFS layer: FAT32, ext2, CXNTFS (proprietary), tmpfs, procfs, sysfs.

Looking Forward

Future work includes network stack refinements, ARM64 port progress, and a GUI/display server.


Technical overview by Mihai209.