]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugMp.c
UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / DebugAgentCommon / DebugMp.c
index 6ae9deef10c78cc3662c2e19b0890abc4be78bf1..d49d4ee32347f6481f0d320dbb94aeb03b1f57f4 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Multi-Processor support functions implementation.\r
 \r
-  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2016, 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
@@ -138,10 +138,22 @@ GetProcessorIndex (
 **/\r
 BOOLEAN\r
 IsBsp (\r
-  IN UINT32             ProcessorIndex\r
+  IN UINT32  ProcessorIndex\r
   )\r
 {\r
-  if (AsmMsrBitFieldRead64 (MSR_IA32_APIC_BASE_ADDRESS, 8, 8) == 1) {\r
+  MSR_IA32_APIC_BASE_REGISTER  MsrApicBase;\r
+  \r
+  //\r
+  // If there are less than 2 CPUs detected, then the currently executing CPU\r
+  // must be the BSP.  This avoids an access to an MSR that may not be supported \r
+  // on single core CPUs.\r
+  //\r
+  if (mDebugCpuData.CpuCount < 2) {\r
+    return TRUE;\r
+  }\r
+\r
+  MsrApicBase.Uint64 = AsmReadMsr64 (MSR_IA32_APIC_BASE);\r
+  if (MsrApicBase.Bits.BSP == 1) {\r
     if (mDebugMpContext.BspIndex != ProcessorIndex) {\r
       AcquireMpSpinLock (&mDebugMpContext.MpContextSpinLock);\r
       mDebugMpContext.BspIndex = ProcessorIndex;\r