summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm
diff options
context:
space:
mode:
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm')
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm16
1 files changed, 14 insertions, 2 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm
index 5666322486..a3c9c7219c 100644
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm
+++ b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm
@@ -117,11 +117,23 @@ LongModeStart::
;
mov ecx, 1bh ; Read IA32_APIC_BASE MSR
rdmsr
+
+ bt eax, 10 ; Check for x2apic mode
+ jnc LegacyApicMode
+ mov ecx, 802h ; Read APIC_ID
+ rdmsr
+ mov ebx, eax ; ebx == apicid
+ jmp GetCpuNumber
+
+LegacyApicMode::
+
and eax, 0fffff000h
add eax, 20h
mov ebx, dword ptr [eax]
- shr ebx, 24
-
+ shr ebx, 24 ; ebx == apicid
+
+GetCpuNumber::
+
xor rcx, rcx
mov edi, esi
add edi, ProcessorNumberLocation