stos/amd64: lapic: Add helper to obtain Local APIC ID

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-27 14:24:05 -05:00
parent 89e87fc525
commit 1020db0f41
2 changed files with 22 additions and 0 deletions
+17
View File
@@ -236,6 +236,23 @@ MdLapicSendIpi(UCHAR Vector, UCHAR DestId, BOOLEAN LogicalDest,
LapicRegWrite(Mcb, LAPIC_ICRLO, ((UQUAD)DestId << 32) | IcrLow); LapicRegWrite(Mcb, LAPIC_ICRLO, ((UQUAD)DestId << 32) | IcrLow);
} }
ULONG
MdLapicId(VOID)
{
KPCR *ThisCore;
MCB *Mcb;
ThisCore = HalKpcrCurrent();
Mcb = &ThisCore->Mcb;
/* 32-bit when in x2APIC mode */
if (Mcb->HasX2Apic) {
return LapicRegRead(Mcb, LAPIC_ID) & 0xFFFFFFFF;
}
return (LapicRegRead(Mcb, LAPIC_ID) >> 24) & 0xF;
}
VOID VOID
MdLapicInit(KPCR *Kpcr) MdLapicInit(KPCR *Kpcr)
{ {
+5
View File
@@ -64,6 +64,11 @@ typedef enum {
*/ */
VOID MdLapicInit(KPCR *Kpcr); VOID MdLapicInit(KPCR *Kpcr);
/*
* Obtain the APIC ID of the current processor
*/
ULONG MdLapicId(VOID);
/* /*
* Send an inter-processor interrupt * Send an inter-processor interrupt
* *