From 98c93e76d7cb7106858454d4351ad08c69692425 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Thu, 21 Oct 2010 17:07:07 +0000 Subject: [PATCH] Zero no more hardwired as BSP apic id - the BSP apic id is written in the io apic redirection entries to deliver the interrupts to BSP --- kernel/arch/i386/apic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 1655f1672..bc8b8a3fe 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -399,7 +399,7 @@ PUBLIC void ioapic_mask_irq(unsigned irq) PUBLIC unsigned int apicid(void) { - return lapic_read(LAPIC_ID); + return lapic_read(LAPIC_ID) >> 24; } PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook)) @@ -1100,6 +1100,7 @@ PUBLIC int apic_single_cpu_init(void) } bsp_lapic_id = apicid(); + printf("Boot cpu apic id %d\n", bsp_lapic_id); acpi_init(); @@ -1186,7 +1187,7 @@ PUBLIC void ioapic_set_irq(unsigned irq) /* * route the interrupts to the bsp by default */ - hi_32 = 0; + hi_32 = bsp_lapic_id << 24; ioapic_redirt_entry_write((void *) io_apic[ioa].addr, io_apic_irq[irq].pin, hi_32, low_32); } -- 2.44.0