Split xapic / x2apic read ids
authorJack Miller <jack@codezen.org>
Thu, 24 Mar 2016 18:25:27 +0000 (13:25 -0500)
committerJack Miller <jack@codezen.org>
Fri, 25 Mar 2016 21:59:17 +0000 (16:59 -0500)
x2apic is full 32 bit already, xapic is only 8 bits

kernel/apic.c

index 882bb85..d9e09b8 100644 (file)
@@ -144,11 +144,6 @@ static void apic_wake_secondary(u8 apic_id)
        apic->wait();
 }
 
-static u8 apic_get_id(void)
-{
-       return ID(apic->read(APIC_ID));
-}
-
 static void xapic_init(void)
 {
        u64 msr;
@@ -186,12 +181,17 @@ static void xapic_write_icr(u32 dest, u32 val)
        apic->write(APIC_ICRL, val);
 }
 
+static u8 xapic_get_id(void)
+{
+       return ID(apic->read(APIC_ID));
+}
+
 struct apic xapic = {
        .init = xapic_init,
        .eoi = apic_eoi,
        .wake_secondary = apic_wake_secondary,
        .start_timer = apic_start_timer,
-       .get_id = apic_get_id,
+       .get_id = xapic_get_id,
        .write = xapic_mmio_write,
        .write_icr = xapic_write_icr,
        .read = xapic_mmio_read,
@@ -231,12 +231,17 @@ static void x2apic_write_icr(u32 dest, u32 val)
        apic->write(APIC_ICRL, ((u64) dest << 32) + val);
 }
 
+static u8 x2apic_get_id(void)
+{
+       return apic->read(APIC_ID);
+}
+
 struct apic x2apic = {
        .init = x2apic_init,
        .eoi = apic_eoi,
        .wake_secondary = apic_wake_secondary,
        .start_timer = apic_start_timer,
-       .get_id = apic_get_id,
+       .get_id = x2apic_get_id,
        .read = x2apic_msr_read,
        .write = x2apic_msr_write,
        .write_icr = x2apic_write_icr,