apic 0.1.0

Interface to the Advanced Programmable Interrupt Controller (APIC)
1
2
3
4
5
6
7
8
9
10
11
12
use crate::LocalApic;

pub struct XApic;

impl LocalApic for XApic {
    fn supported() -> bool {
        // APIC support denoted by bit 9 of edx, eax=1
        // https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits
        let cpuid = unsafe { core::arch::x86_64::__cpuid(0x1) };
        cpuid.edx & (1 << 9) != 0
    }
}