From: Nadav Amit <nadav.amit@xxxxxxxxx> test_enable_x2apic() unintentionally changes the APIC base address to zero and resets the BSP indication. This actually causes the local APIC to overlap the IDT area, which is wrong. Prevent it from happening by keeping the APIC base address and BSP-bit as it was before. Signed-off-by: Nadav Amit <nadav.amit@xxxxxxxxx> --- x86/apic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x86/apic.c b/x86/apic.c index 51744cf..0849f87 100644 --- a/x86/apic.c +++ b/x86/apic.c @@ -90,11 +90,11 @@ static void test_enable_x2apic(void) report("disabled to x2apic enabled", test_write_apicbase_exception(APIC_EN | APIC_EXTD)); - wrmsr(MSR_IA32_APICBASE, APIC_EN); + wrmsr(MSR_IA32_APICBASE, APIC_EN | APIC_DEFAULT_PHYS_BASE | APIC_BSP); report("apic enabled to invalid state", test_write_apicbase_exception(APIC_EXTD)); - wrmsr(MSR_IA32_APICBASE, APIC_EN | APIC_EXTD); + wrmsr(MSR_IA32_APICBASE, APIC_EN | APIC_EXTD | APIC_DEFAULT_PHYS_BASE | APIC_BSP); apic_write(APIC_SPIV, 0x1ff); } else { printf("x2apic not detected\n"); -- 2.17.1