Skip to main content

X2Apic

Struct X2Apic 

Source
pub struct X2Apic {
    _private: (),
}

Fields§

§_private: ()

Implementations§

Source§

impl X2Apic

Source

pub fn new() -> Option<Self>

Source

pub fn is_supported() -> bool

Source

pub fn enable(&self) -> Result<(), &'static str>

Enable x2APIC mode on this CPU.

Performs the two-step enable sequence:

  1. Ensure APIC global enable (EN=1) in IA32_APIC_BASE.
  2. Set x2APIC enable (EXTD=1).

Writes the Spurious Interrupt Vector Register to finalize.

Returns Err if the CPU refuses to enter x2APIC mode (e.g. BIOS locked the APIC base, or the CPU doesn’t actually support x2APIC).

Source

pub fn read_and_clear_esr(&self) -> u32

Read and clear the Error Status Register.

After a send_ipi() the ESR should be read to detect delivery errors (illegal vector, accept error, etc.). Writes-1-to-clear, so we write 0 then read to snapshot.

Source

pub fn id(&self) -> u32

Source

pub fn version(&self) -> u32

Source

pub fn eoi(&self)

Source

pub fn send_ipi(&self, target_id: u32, vector: u8)

Send an IPI to a specific x2APIC destination.

Uses Fixed delivery mode, physical destination, edge-triggered, no shorthand. This is the common-case IPI (reschedule, TLB shootdown, etc.).

Source

pub fn send_init_ipi(&self, target_id: u32)

Send an INIT IPI to a specific x2APIC destination.

INIT IPIs use Delivery Mode = 101 (INIT). In x2APIC mode the Level bit is not meaningful for INIT delivery, but is set to 1 (assert) by convention to match xAPIC-compatible INIT sequences.

Source

pub fn send_startup_ipi(&self, target_id: u32, start_page: u8)

Send a STARTUP IPI (SIPI) to a specific x2APIC destination.

start_page is the start-up vector (page frame number of the real-mode entry point, e.g. 0x08 for physical 0x0800). The CPU begins execution at start_page << 12 in real mode after receiving SIPI.

Source

pub fn configure_timer( &self, initial_count: u32, vector: u8, periodic: bool, divide: TimerDivide, )

Configure the LVT timer.

Programs the divide configuration, LVT entry, and initial count in the correct order (SDM requires: DIV → LVT → INIT_COUNT).

Source

pub fn mask_timer(&self)

Mask the LVT timer (set mask bit = 1 → timer interrupt suppressed).

Source

pub fn unmask_timer(&self)

Unmask the LVT timer (clear mask bit = 0 → timer interrupt delivered).

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.