diff options
author | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-26 07:36:15 +0000 |
---|---|---|
committer | rsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-09-26 07:36:15 +0000 |
commit | 0dfef49a30ac932f994683a4482c8b949491785c (patch) | |
tree | a1716b1f369e21a055aa66739cd89b267f4d5751 /EdkCompatibilityPkg/Compatibility | |
parent | a1f7e1e34fb3341a9e28a5bf9cb04ee64bff1869 (diff) | |
download | edk2-platforms-0dfef49a30ac932f994683a4482c8b949491785c.tar.xz |
EdkCompatibilityPkg MpServicesOnFrameworkMpServicesThunk: Check for x2APIC mode before accessing the APIC ID register in RendezvousFunnelProc().
Contributed by Bruce Losure.
Signed-off-by: rsun3
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12442 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility')
-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
|