### Initialize and Configure IOAPIC Source: https://github.com/kwzhao/x2apic-rs/blob/master/README.md Initializes the IOAPIC and configures a redirection table entry for a specific IRQ. Ensure the IOAPIC's MMIO address is mapped correctly before use. This snippet demonstrates setting interrupt mode, flags, destination, and enabling the IRQ. ```rust use x2apic::ioapic::{IoApic, IrqFlags, IrqMode, RedirectionTableEntry}; // !!! Map the IOAPIC's MMIO address `addr` here !!! unsafe { let ioapic = IoApic::new(addr); ioapic.init(irq_offset); let mut entry = RedirectionTableEntry::default(); entry.set_mode(IrqMode::Fixed); entry.set_flags(IrqFlags::LEVEL_TRIGGERED | IrqFlags::LOW_ACTIVE | IrqFlags::MASKED); entry.set_dest(dest); // CPU(s) ioapic.set_table_entry(irq_number, entry); ioapic.enable_irq(irq_number); } ``` -------------------------------- ### Initialize and Enable Local APIC Source: https://github.com/kwzhao/x2apic-rs/blob/master/README.md Initializes and enables the local APIC timer with a default configuration. The timer can be configured further using the builder or directly on the APIC. Ensure the APIC base address is correctly mapped. ```rust use x2apic::lapic::{LocalApic, LocalApicBuilder, xapic_base}; let apic_physical_address: u64 = unsafe { xapic_base() }; let apic_virtual_address: u64 = let lapic = LocalApicBuilder::new() .timer_vector(timer_index) .error_vector(error_index) .spurious_vector(spurious_index) .set_xapic_base(apic_virtual_address) .build() .unwrap_or_else(|err| panic!("{}", err)); unsafe { lapic.enable(); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.