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
impl IoApic
sourcepub fn create(
page_table: &mut PageTable,
id: u8,
phys_addr: PhysicalAddress,
gsi_base: u32
) -> Result<(), &'static str>
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.
sourcepub fn handles_irq(&self, irq_num: u32) -> bool
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
.
sourcepub fn arbitration_id(&mut self) -> u32
pub fn arbitration_id(&mut self) -> u32
gets this IoApic’s arbitration id.
sourcepub fn mask_irq(&mut self, irq: u8)
pub fn mask_irq(&mut self, irq: u8)
Masks (disables) the given IRQ line. NOTE: this function is UNTESTED!
sourcepub fn set_irq(
&mut self,
ioapic_irq: u8,
apic_id: ApicId,
irq_vector: u8
) -> Result<(), &'static str>
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 (seeinterrupts::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 givenApicId
value exceeds the bounds ofu8
, 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§
impl RefUnwindSafe for IoApic
impl Send for IoApic
impl Sync for IoApic
impl Unpin for IoApic
impl UnwindSafe for IoApic
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more