stos/amd64: cpu: Hardware enable Local APIC

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-26 20:22:20 +00:00
parent 221cfc1893
commit 38310e4f23
+17
View File
@@ -7,6 +7,7 @@
*/ */
#include <machine/lapic.h> #include <machine/lapic.h>
#include <machine/lapicreg.h>
#include <machine/msr.h> #include <machine/msr.h>
#include <machine/cpuid.h> #include <machine/cpuid.h>
#include <ex/trace.h> #include <ex/trace.h>
@@ -39,6 +40,20 @@ LapicIsSupported(VOID)
return ISSET(Edx, BIT(9)) != 0; 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 VOID
MdLapicInit(KPCR *Kpcr) MdLapicInit(KPCR *Kpcr)
{ {
@@ -49,4 +64,6 @@ MdLapicInit(KPCR *Kpcr)
if (!LapicIsSupported()) { if (!LapicIsSupported()) {
KeKnot(KNOT_MISSING_HARDWARE, "local apic not supported\n"); KeKnot(KNOT_MISSING_HARDWARE, "local apic not supported\n");
} }
LapicEnable();
} }