stos/amd64: lapic: Detect if x2APIC mode is present
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -43,6 +43,19 @@ LapicIsSupported(VOID)
|
||||
return ISSET(Edx, BIT(9)) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if the CPU can operate its Local APIC unit
|
||||
* in the newer x2APIC mode.
|
||||
*/
|
||||
static BOOLEAN
|
||||
LapicHasX2Apic(VOID)
|
||||
{
|
||||
ULONG Ecx, Unused;
|
||||
|
||||
CPUID(1, Unused, Unused, Ecx, Unused);
|
||||
return ISSET(Ecx, BIT(21)) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Enable the Local APIC unit
|
||||
*/
|
||||
@@ -85,6 +98,7 @@ MdLapicInit(KPCR *Kpcr)
|
||||
|
||||
Mcb = &Kpcr->Mcb;
|
||||
Mcb->LapicBase = PMA_TO_VMA((UPTR)Madt->LapicAddr);
|
||||
Mcb->HasX2Apic = LapicHasX2Apic();
|
||||
|
||||
/* Enable the Local APIC */
|
||||
LapicEnable();
|
||||
|
||||
Reference in New Issue
Block a user