Expand description
Local APIC (Advanced Programmable Interrupt Controller) driver
Provides MMIO-based access to the Local APIC registers. The Local APIC base address is discovered via ACPI MADT and accessed through the HHDM (Higher Half Direct Map).
ConstantsΒ§
- APIC_
BASE_ πADDR_ MASK - IA32_APIC_BASE physical base address mask (up to MAXPHYADDR 52 bits).
- APIC_
BASE_ πENABLE - APIC global enable bit in IA32_APIC_BASE MSR
- APIC_
BASE_ πEXTD - x2APIC enable bit in IA32_APIC_BASE MSR
- IA32_
APIC_ πBASE_ MSR - MSR address for APIC base
- IPI_
RESCHED_ VECTOR - Vector used for cross-CPU reschedule IPIs.
- IPI_
TLB_ SHOOTDOWN_ VECTOR - Vector used for TLB shootdown IPIs.
- LVT_
TIMER_ MASKED - LVT Timer: masked (bit 16)
- LVT_
TIMER_ PERIODIC - LVT Timer: periodic mode (bit 17)
- LVT_
TIMER_ VECTOR - Dedicated Local APIC timer interrupt vector (aligned with Theseus-style setup).
- REG_EOI π
- End of Interrupt Register
- REG_ESR
- Error Status Register
- REG_
ICR_ HIGH - Interrupt Command Register (high)
- REG_
ICR_ LOW - Interrupt Command Register (low)
- REG_ID π
- Local APIC ID Register
- REG_
LVT_ TIMER - LVT Timer Register
- REG_
SPURIOUS π - Spurious Interrupt Vector Register
- REG_
TIMER_ CURRENT - Timer Current Count Register
- REG_
TIMER_ DIVIDE - Timer Divide Configuration Register
- REG_
TIMER_ INIT - Timer Initial Count Register
- REG_TPR π
- Task Priority Register
- REG_
VERSION π - Local APIC Version Register
- SPURIOUS_
VECTOR π - Spurious interrupt vector number
StaticsΒ§
- APIC_
BASE_ πPHYS - Physical base address of the Local APIC MMIO registers (used by address-space init)
- APIC_
BASE_ πVIRT - Virtual base address of the Local APIC MMIO registers
- APIC_
INITIALIZED π - Whether the Local APIC has been initialized
- APIC_
X2_ πMODE - Whether x2APIC mode is active.
- ICR_
HIGH_ πSHADOW - Per-CPU shadow of xAPIC-compatible ICR high writes (destination field).
FunctionsΒ§
- current_
cpu_ πslot - eoi
- Send End-of-Interrupt to the Local APIC
- init
- Initialize the Local APIC.
- init_ap
- Initialize per-core Local APIC state on Application Processors.
- is_
initialized - Check if the Local APIC has been initialized
- is_
present - Check if APIC is present via CPUID
- is_
x2apic_ enabled - Returns true when Local APIC is running in x2APIC mode.
- is_
x2apic_ supported - Check if x2APIC is supported via CPUID
- lapic_
id - Get the current Local APIC ID.
- lapic_
phys - Return the physical base address of the LAPIC MMIO region, or 0 if not yet initialized.
- read_
reg β - Read a Local APIC register
- send_
ipi_ raw - Send an IPI with a pre-built ICR low value to a specific APIC destination.
- send_
resched_ ipi - Send a βreschedule nowβ IPI to the CPU identified by
target_apic_id. - write_
reg β - Write a Local APIC register
- x2apic_
msr_ πfor_ reg