]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLib.c
SourceLevelDebugPkg: Convert source file to DOS format
[mirror_edk2.git] / SourceLevelDebugPkg / Library / PeCoffExtraActionLibDebug / PeCoffExtraActionLib.c
index 84cfe19efc1a0c30f92ed5bf3dbde43c997a084c..87420709f6c31f98c1d2d2bda669b5bbb6788e00 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   PE/Coff Extra Action library instances.\r
 \r
-  Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2015, 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
@@ -65,6 +65,7 @@ PeCoffLoaderExtraActionCommon (
   IA32_DESCRIPTOR            IdtDescriptor;\r
   IA32_IDT_GATE_DESCRIPTOR   OriginalIdtEntry;\r
   BOOLEAN                    IdtEntryHooked;\r
+  UINT32                     RegEdx;\r
 \r
   ASSERT (ImageContext != NULL);\r
 \r
@@ -79,6 +80,16 @@ PeCoffLoaderExtraActionCommon (
 \r
   IdtEntryHooked  = FALSE;\r
   LoadImageMethod = PcdGet8 (PcdDebugLoadImageMethod);\r
+  if (LoadImageMethod == DEBUG_LOAD_IMAGE_METHOD_IO_HW_BREAKPOINT) {\r
+    //\r
+    // If the CPU does not support Debug Extensions(CPUID:01 EDX:BIT2)\r
+    // then force use of DEBUG_LOAD_IMAGE_METHOD_SOFT_INT3 \r
+    //\r
+    AsmCpuid (1, NULL, NULL, NULL, &RegEdx);\r
+    if ((RegEdx & BIT2) == 0) {\r
+      LoadImageMethod = DEBUG_LOAD_IMAGE_METHOD_SOFT_INT3;\r
+    }\r
+  }\r
   AsmReadIdtr (&IdtDescriptor);\r
   if (LoadImageMethod == DEBUG_LOAD_IMAGE_METHOD_SOFT_INT3) {\r
     if (!CheckDebugAgentHandler (&IdtDescriptor, SOFT_INT_VECTOR_NUM)) {\r