]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: DefaultExceptionHandler fixes for use with DxeCore
authorCohen, Eugene <eugene@hp.com>
Wed, 10 Feb 2016 23:05:18 +0000 (23:05 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 15 Feb 2016 09:37:52 +0000 (10:37 +0100)
Modify the DefaultExceptionHandler (uefi-variant) so it can be used by
DxeCore (via CpuExceptionHandlerLib) where the debug info table is not
yet published at library constructor time.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c
ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c

index 49d36ed69329878ecffb6d1f9cdbf2b455fd8d10..37fd57875760d80e708fb082712c000f83be1c4e 100644 (file)
@@ -27,8 +27,6 @@
 #include <Protocol/DebugSupport.h>\r
 #include <Protocol/LoadedImage.h>\r
 \r
-EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *gDebugImageTableHeader = NULL;\r
-\r
 STATIC CHAR8 *gExceptionTypeString[] = {\r
   "Synchronous",\r
   "IRQ",\r
index 179fc224be54c8666ec4df07ee70d7a459292ad3..aece26355e2e72b37018a3b3d504af2f821116d1 100644 (file)
@@ -27,8 +27,6 @@
 #include <Protocol/DebugSupport.h>\r
 #include <Library/DefaultExceptionHandlerLib.h>\r
 \r
-EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *gDebugImageTableHeader = NULL;\r
-\r
 typedef struct {\r
   UINT32  BIT;\r
   CHAR8   Char;\r
index da8190bd3c5500a78c17920272868753dbf2df33..5d3ce892ff3cf92df4f9a4e552ecfdd8247b61b8 100644 (file)
@@ -20,7 +20,6 @@
   MODULE_TYPE                    = UEFI_DRIVER\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = DefaultExceptionHandlerLib\r
-  CONSTRUCTOR                    = DefaultExceptionHandlerConstructor\r
 \r
 [Sources.common]\r
   DefaultExceptionHandlerUefi.c\r
index b2d630cb33edb06d4249b1c2e38f1e118a4ffc1c..4e87a1005dde520bdd94f5cc54db04e997466f80 100644 (file)
 \r
 #include <Guid/DebugImageInfoTable.h>\r
 \r
-extern EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *gDebugImageTableHeader;\r
-\r
-/**\r
-  The constructor function caches EFI Debug table information for use in the exception handler.\r
-\r
-\r
-  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
-  @param  SystemTable   A pointer to the EFI System Table.\r
-\r
-  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DefaultExceptionHandlerConstructor (\r
-  IN EFI_HANDLE                ImageHandle,\r
-  IN EFI_SYSTEM_TABLE          *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&gDebugImageTableHeader);\r
-  if (EFI_ERROR (Status)) {\r
-    gDebugImageTableHeader = NULL;\r
-  }\r
-  return Status;\r
-}\r
-\r
 /**\r
   Use the EFI Debug Image Table to lookup the FaultAddress and find which PE/COFF image\r
   it came from. As long as the PE/COFF image contains a debug directory entry a\r
@@ -67,17 +39,24 @@ GetImageName (
   OUT UINTN  *PeCoffSizeOfHeaders\r
   )\r
 {\r
-  EFI_DEBUG_IMAGE_INFO  *DebugTable;\r
-  UINTN                 Entry;\r
-  CHAR8                 *Address;\r
+  EFI_STATUS                          Status;\r
+  EFI_DEBUG_IMAGE_INFO_TABLE_HEADER   *DebugTableHeader;\r
+  EFI_DEBUG_IMAGE_INFO                *DebugTable;\r
+  UINTN                               Entry;\r
+  CHAR8                               *Address;\r
+\r
+  Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&DebugTableHeader);\r
+  if (EFI_ERROR (Status)) {\r
+    return NULL;\r
+  }\r
 \r
-  DebugTable = gDebugImageTableHeader->EfiDebugImageInfoTable;\r
+  DebugTable = DebugTableHeader->EfiDebugImageInfoTable;\r
   if (DebugTable == NULL) {\r
     return NULL;\r
   }\r
 \r
   Address = (CHAR8 *)(UINTN)FaultAddress;\r
-  for (Entry = 0; Entry < gDebugImageTableHeader->TableSize; Entry++, DebugTable++) {\r
+  for (Entry = 0; Entry < DebugTableHeader->TableSize; Entry++, DebugTable++) {\r
     if (DebugTable->NormalImage != NULL) {\r
       if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&\r
           (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {\r