diff options
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk')
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm | 14 | ||||
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm | 16 |
2 files changed, 27 insertions, 3 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm index 13f2bb74d2..8c4728f68c 100644 --- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm +++ b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm @@ -90,10 +90,22 @@ ProtectedModeStart:: ; protected mode entry point ;
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 ecx, ecx
mov edi, esi
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
|