Struct apic::LocalApic

source ·
pub struct LocalApic { /* private fields */ }
Expand description

This structure represents a single Local APIC in the system; there is one per CPU.

Implementations§

Creates and initializes a new LocalApic for the current CPU core and adds it to the global set of initialized local APICs.

Arguments
  • page_table: the page table used to map the APIC MMIO registers (only used for xapic, not x2apic).
  • processor_id: the processor ID specified in the ACPI Madt table. This value is currently unused in Theseus.
  • expected_apic_id: the expected APIC ID as specified in the ACPI Madt table.
    • If Some, the APIC’s own ID (given by LocalApic::read_apic_id()) must match this value, otherwise an error will be returned.
    • If None, the local APIC will determine its own ID value, and no check is performed.
  • should_be_bsp: whether or not this CPU is expected to be the BSP.
    • If true, this CPU must be the BSP (bootstrap processor).
    • If false, this CPU must not be the BSP – it must be an AP.
    • An error is returned if the above checks fail.
  • nmi_lint: the local interrupt pin used for NMI. Must be 0 or 1.
  • nmi_flags: the flags used to configure the local NMI interrupt.
Important Usage Note

This MUST be invoked from each CPU itself when it is booting up, i.e., the BSP cannot invoke this for other APs.

Returns the “processor ID” of this local APIC, which is currently unused.

This value comes from the MADT ACPI table entry that was used to boot up this CPU core.

Returns true if this CPU core was the BootStrap Processor (BSP), i.e., the first CPU to boot and run the OS code.

There is only one BSP per system.

Enable (unmask) or disable (mask) the LVT timer interrupt on this lapic.

This does not modify the timer’s current count value.

Returns the ID of this Local APIC (fast).

Unlike LocalApic::read_apic_id(), this does not read any hardware registers.

Reads the hardware-provided ID of this Local APIC from its registers (slow).

Returns the version of this lapic.

Returns the value of this lapic’s error register.

Clears/resets this lapic’s error register.

Reads the current value of this lapic’s Interrupt Control Register.

Writes value to this lapic’s Interrupt Control Register.

Send an IPI to the cores specified by the given destination

Send a NMI IPI to the cores specified by the given destination

Send an End Of Interrupt (EOI) signal to this local APIC, which indicates that the calling interrupt handler has finished handling the current interrupt.

Set the NonMaskableInterrupt redirect for this LocalApic. Argument lint can be either 0 or 1, since each local APIC has two LVT LINTs (Local Vector Table Local INTerrupts)

Returns the values of the 8 in-service registers for this APIC, which is a series of bitmasks that shows which interrupt lines are currently being serviced.

Returns the values of the 8 request registers for this APIC, which is a series of bitmasks that shows which interrupt lines are currently raised, but not yet being serviced.

Clears the interrupt mask bit in the apic performance monitor register.

Trait Implementations§

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

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