From 38310e4f234f2fd3cefd7d7529736249bdb9109a Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Fri, 26 Jun 2026 20:22:20 +0000 Subject: [PATCH] stos/amd64: cpu: Hardware enable Local APIC Signed-off-by: Chloe M. --- paw/stos/arch/amd64/cpu/lapic.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/paw/stos/arch/amd64/cpu/lapic.c b/paw/stos/arch/amd64/cpu/lapic.c index dc52a22..3cc0bfc 100644 --- a/paw/stos/arch/amd64/cpu/lapic.c +++ b/paw/stos/arch/amd64/cpu/lapic.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -39,6 +40,20 @@ LapicIsSupported(VOID) return ISSET(Edx, BIT(9)) != 0; } +/* + * Enable the Local APIC unit + */ +static VOID +LapicEnable(VOID) +{ + UQUAD ApicBase; + + /* Hardware enable the Local APIC unit */ + ApicBase = MdRdmsr(IA32_APIC_BASE_MSR); + ApicBase |= LAPIC_HW_ENABLE; + MdWrmsr(IA32_APIC_BASE_MSR, ApicBase); +} + VOID MdLapicInit(KPCR *Kpcr) { @@ -49,4 +64,6 @@ MdLapicInit(KPCR *Kpcr) if (!LapicIsSupported()) { KeKnot(KNOT_MISSING_HARDWARE, "local apic not supported\n"); } + + LapicEnable(); }