⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

init

Function init 

Source
pub fn init() -> KernelResult<()>
Expand description

Initialize the Local APIC and I/O APIC.

This function:

  1. Reads the APIC base address from the IA32_APIC_BASE MSR.
  2. Ensures the global APIC enable bit is set in the MSR.
  3. Translates physical MMIO addresses to virtual using the bootloader’s physical memory offset.
  4. Initializes the Local APIC (software enable, mask all LVTs, set TPR=0).
  5. Initializes the I/O APIC (mask all redirection entries).

Must be called after GDT/IDT initialization but before interrupts are enabled. Safe to call exactly once; subsequent calls return AlreadyExists.