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

LocalApic

Struct LocalApic 

Source
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

Source

pub fn read_id(&self) -> u8

Read the Local APIC ID (bits 31:24 of the ID register).

Source

pub fn read_version(&self) -> u32

Read the Local APIC version register.

Source

pub fn send_eoi(&self)

Send an End-Of-Interrupt signal. Must be called at the end of every Local APIC interrupt handler.

Source

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.
Source

pub fn stop_timer(&self)

Stop the APIC timer by zeroing the initial count and masking the LVT Timer entry.

Source

pub fn read_timer_count(&self) -> u32

Read the current timer count (counts down from the initial value).

Source

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.
Source

pub fn send_init_ipi(&self, dest: u8)

Send an INIT IPI to a target CPU (used in AP startup sequence).

Source

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).

Source

pub fn send_ipi_all_excluding_self(&self, vector: u8)

Broadcast IPI to all CPUs except self.

Auto Trait Implementations§

§

impl Freeze for LocalApic

§

impl RefUnwindSafe for LocalApic

§

impl Send for LocalApic

§

impl Sync for LocalApic

§

impl Unpin for LocalApic

§

impl UnwindSafe for LocalApic

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.