summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-26 07:36:15 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-26 07:36:15 +0000
commit0dfef49a30ac932f994683a4482c8b949491785c (patch)
treea1716b1f369e21a055aa66739cd89b267f4d5751 /EdkCompatibilityPkg
parenta1f7e1e34fb3341a9e28a5bf9cb04ee64bff1869 (diff)
downloadedk2-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')
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/IA32/MpFuncs.asm14
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.asm16
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