pub struct LocalApic { /* private fields */ }Expand description
Local APIC controller.
Wraps the memory-mapped register file for the per-CPU Local APIC. All register accesses use volatile reads/writes to prevent compiler reordering.
Implementations§
Source§impl LocalApic
impl LocalApic
Sourcepub fn read_version(&self) -> u32
pub fn read_version(&self) -> u32
Read the Local APIC version register.
Sourcepub fn send_eoi(&self)
pub fn send_eoi(&self)
Send an End-Of-Interrupt signal. Must be called at the end of every Local APIC interrupt handler.
Sourcepub fn setup_timer(&self, vector: u8, divide: u8, initial_count: u32)
pub fn setup_timer(&self, vector: u8, divide: u8, initial_count: u32)
Configure the APIC timer for periodic interrupts.
vector: IDT vector number for the timer interrupt.divide: Timer divisor encoded as the Divide Configuration Register value (e.g., 0x03 = divide by 16, 0x0B = divide by 1).initial_count: Initial countdown value. The timer fires when it reaches zero and reloads automatically in periodic mode.
Sourcepub fn stop_timer(&self)
pub fn stop_timer(&self)
Stop the APIC timer by zeroing the initial count and masking the LVT Timer entry.
Sourcepub fn read_timer_count(&self) -> u32
pub fn read_timer_count(&self) -> u32
Read the current timer count (counts down from the initial value).
Sourcepub fn send_ipi(&self, dest: u8, vector: u8)
pub fn send_ipi(&self, dest: u8, vector: u8)
Write the Interrupt Command Register to send an IPI.
dest: Destination APIC ID.vector: Interrupt vector.
Sourcepub fn send_init_ipi(&self, dest: u8)
pub fn send_init_ipi(&self, dest: u8)
Send an INIT IPI to a target CPU (used in AP startup sequence).
Sourcepub fn send_startup_ipi(&self, dest: u8, startup_page: u8)
pub fn send_startup_ipi(&self, dest: u8, startup_page: u8)
Send a Startup IPI (SIPI) to a target CPU.
startup_page is the physical page number (e.g., 0x08 for 0x8000).
Sourcepub fn send_ipi_all_excluding_self(&self, vector: u8)
pub fn send_ipi_all_excluding_self(&self, vector: u8)
Broadcast IPI to all CPUs except self.