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
This commit is contained in:
rsun3 2011-09-26 07:36:15 +00:00
parent a1f7e1e34f
commit 0dfef49a30
2 changed files with 27 additions and 3 deletions

View File

@ -90,10 +90,22 @@ ProtectedModeStart:: ; protected mode entry point
; ;
mov ecx, 1bh ; Read IA32_APIC_BASE MSR mov ecx, 1bh ; Read IA32_APIC_BASE MSR
rdmsr 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 and eax, 0fffff000h
add eax, 20h add eax, 20h
mov ebx, dword ptr [eax] mov ebx, dword ptr [eax]
shr ebx, 24 shr ebx, 24 ; ebx == apicid
GetCpuNumber::
xor ecx, ecx xor ecx, ecx
mov edi, esi mov edi, esi

View File

@ -117,10 +117,22 @@ LongModeStart::
; ;
mov ecx, 1bh ; Read IA32_APIC_BASE MSR mov ecx, 1bh ; Read IA32_APIC_BASE MSR
rdmsr 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 and eax, 0fffff000h
add eax, 20h add eax, 20h
mov ebx, dword ptr [eax] mov ebx, dword ptr [eax]
shr ebx, 24 shr ebx, 24 ; ebx == apicid
GetCpuNumber::
xor rcx, rcx xor rcx, rcx
mov edi, esi mov edi, esi