Struct ioapic::IoApic

source ·
pub struct IoApic {
    pub id: u8,
    /* private fields */
}
Expand description

A representation of an IoApic (x86-specific interrupt chip for I/O devices).

Fields§

§id: u8

The ID of this IoApic.

Implementations§

source§

impl IoApic

source

pub fn create( page_table: &mut PageTable, id: u8, phys_addr: PhysicalAddress, gsi_base: u32 ) -> Result<(), &'static str>

Creates a new IoApic struct from the given id, PhysicalAddress, and gsi_base, and then adds it to the system-wide list of all IOAPICs.

source

pub fn handles_irq(&self, irq_num: u32) -> bool

Returns whether this IoApic handles the given irq_num, i.e., whether it’s within the range of IRQs handled by this IoApic.

source

pub fn id(&mut self) -> u32

gets this IoApic’s id.

source

pub fn version(&mut self) -> u32

gets this IoApic’s version.

source

pub fn arbitration_id(&mut self) -> u32

gets this IoApic’s arbitration id.

source

pub fn mask_irq(&mut self, irq: u8)

Masks (disables) the given IRQ line. NOTE: this function is UNTESTED!

source

pub fn set_irq( &mut self, ioapic_irq: u8, apic_id: ApicId, irq_vector: u8 ) -> Result<(), &'static str>

Set IRQ to an interrupt vector.

Arguments
  • ioapic_irq: the IRQ number that this interrupt will trigger on this IoApic.
  • apic_id: the ID of the Local APIC, i.e., the CPU, that should handle this interrupt.
  • irq_vector: the system-wide IRQ vector number, which after remapping is from 0x20 to 0x2F (see interrupts::IRQ_BASE_OFFSET). For example, 0x20 is the PIT timer, 0x21 is the PS2 keyboard, etc.
Return
  • Returns Ok upon success
  • Returns Err if the given ApicId value exceeds the bounds of u8, i.e., if it is larger than 255. This is because the IOAPIC only supports redirecting interrupts to APICs with IDs that fit within 8-bit values.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.