Skip to main content

Module apic

Module apic 

Source
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 πŸ”’