#------------------------------------------------------------------------------\r
# IA32 assembly file for AP startup vector.\r
#\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
#\r
movl $0x1b, %ecx\r
rdmsr\r
+\r
+ btl $10, %eax # Check for x2apic mode\r
+ jnc LegacyApicMode\r
+ movl $0x802, %ecx # Read APIC_ID\r
+ rdmsr\r
+ movl %eax, %ebx # ebx == apicid\r
+ jmp GetCpuNumber\r
+\r
+LegacyApicMode:\r
andl $0xfffff000, %eax\r
addl $0x20, %eax\r
movl (%eax), %ebx\r
- shrl $24, %ebx\r
- \r
+ shrl $24, %ebx # ebx == apicid\r
+\r
+GetCpuNumber: \r
xorl %ecx, %ecx\r
movl %esi,%edi\r
addl $ProcessorNumber, %edi\r