]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SourceLevelDebugPkg/PeCoffExtraActionLibDebug: Support IA32 processors without debug...
authorMichael Kinney <michael.d.kinney@intel.com>
Mon, 27 Apr 2015 19:51:46 +0000 (19:51 +0000)
committermdkinney <mdkinney@Edk2>
Mon, 27 Apr 2015 19:51:46 +0000 (19:51 +0000)
Use CPUID Leaf 01 to detect support for debug extensions.
Force use of software breakpoints if debug extensions are not supported.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17219 6f19259b-4bc3-4df7-8a09-765794883524

SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLib.c
SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf

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
index 717aa97d8705fd300faae6fe417b4be0bda8649b..e53f1d936c127c3a6795b46869245aeb62ff6c7c 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  PeCoffExtraAction Library to support source level debug.\r
 #\r
-#  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -19,7 +19,7 @@
   MODULE_UNI_FILE                = PeCoffExtraActionLib.uni\r
   FILE_GUID                      = 8F01CBD5-E069-44d7-90C9-35F0318603AD\r
   MODULE_TYPE                    = BASE\r
-  VERSION_STRING                 = 0.7\r
+  VERSION_STRING                 = 0.8\r
   LIBRARY_CLASS                  = PeCoffExtraActionLib\r
 \r
 #\r