On 12 February 2016 at 11:19, Ard Biesheuvel <ard.biesheu...@linaro.org> wrote: > On 11 February 2016 at 00:05, Cohen, Eugene <eug...@hp.com> wrote: >> 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 <eug...@hp.com> > > One coding style nit below, but I will fix that up when applying > > Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> >
Thanks all. Pushed to master. >> --- >> .../AArch64/DefaultExceptionHandler.c | 2 - >> .../Arm/DefaultExceptionHandler.c | 2 - >> .../DefaultExceptionHandlerLib.inf | 1 - >> .../DefaultExceptionHandlerUefi.c | 43 >> +++++----------------- >> 4 files changed, 10 insertions(+), 38 deletions(-) >> >> diff --git >> a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c >> >> b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c >> index 49d36ed..37fd578 100644 >> --- >> a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c >> +++ >> b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c >> @@ -27,8 +27,6 @@ >> #include <Protocol/DebugSupport.h> >> #include <Protocol/LoadedImage.h> >> >> -EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *gDebugImageTableHeader = NULL; >> - >> STATIC CHAR8 *gExceptionTypeString[] = { >> "Synchronous", >> "IRQ", >> diff --git >> a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c >> b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c >> index 179fc22..aece263 100644 >> --- a/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c >> +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/Arm/DefaultExceptionHandler.c >> @@ -27,8 +27,6 @@ >> #include <Protocol/DebugSupport.h> >> #include <Library/DefaultExceptionHandlerLib.h> >> >> -EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *gDebugImageTableHeader = NULL; >> - >> typedef struct { >> UINT32 BIT; >> CHAR8 Char; >> diff --git >> a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf >> b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf >> index da8190b..5d3ce89 100644 >> --- >> a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf >> +++ >> b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf >> @@ -20,7 +20,6 @@ >> MODULE_TYPE = UEFI_DRIVER >> VERSION_STRING = 1.0 >> LIBRARY_CLASS = DefaultExceptionHandlerLib >> - CONSTRUCTOR = DefaultExceptionHandlerConstructor >> >> [Sources.common] >> DefaultExceptionHandlerUefi.c >> diff --git >> a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c >> b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c >> index b2d630c..02e6c9a 100644 >> --- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c >> +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c >> @@ -18,34 +18,6 @@ >> >> #include <Guid/DebugImageInfoTable.h> >> >> -extern EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *gDebugImageTableHeader; >> - >> -/** >> - The constructor function caches EFI Debug table information for use in >> the exception handler. >> - >> - >> - @param ImageHandle The firmware allocated handle for the EFI image. >> - @param SystemTable A pointer to the EFI System Table. >> - >> - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. >> - >> -**/ >> -EFI_STATUS >> -EFIAPI >> -DefaultExceptionHandlerConstructor ( >> - IN EFI_HANDLE ImageHandle, >> - IN EFI_SYSTEM_TABLE *SystemTable >> - ) >> -{ >> - EFI_STATUS Status; >> - >> - Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, >> (VOID **)&gDebugImageTableHeader); >> - if (EFI_ERROR (Status)) { >> - gDebugImageTableHeader = NULL; >> - } >> - return Status; >> -} >> - >> /** >> Use the EFI Debug Image Table to lookup the FaultAddress and find which >> PE/COFF image >> it came from. As long as the PE/COFF image contains a debug directory >> entry a >> @@ -67,17 +39,22 @@ GetImageName ( >> OUT UINTN *PeCoffSizeOfHeaders >> ) >> { >> - EFI_DEBUG_IMAGE_INFO *DebugTable; >> - UINTN Entry; >> - CHAR8 *Address; >> + EFI_STATUS Status; >> + EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *DebugTableHeader; >> + EFI_DEBUG_IMAGE_INFO *DebugTable; >> + UINTN Entry; >> + CHAR8 *Address; >> + >> + Status = EfiGetSystemConfigurationTable(&gEfiDebugImageInfoTableGuid, >> (VOID **)&DebugTableHeader); >> + if (EFI_ERROR(Status)) return NULL; >> > > ^^^ this shouldn't be on a single line > >> - DebugTable = gDebugImageTableHeader->EfiDebugImageInfoTable; >> + DebugTable = DebugTableHeader->EfiDebugImageInfoTable; >> if (DebugTable == NULL) { >> return NULL; >> } >> >> Address = (CHAR8 *)(UINTN)FaultAddress; >> - for (Entry = 0; Entry < gDebugImageTableHeader->TableSize; Entry++, >> DebugTable++) { >> + for (Entry = 0; Entry < DebugTableHeader->TableSize; Entry++, >> DebugTable++) { >> if (DebugTable->NormalImage != NULL) { >> if ((DebugTable->NormalImage->ImageInfoType == >> EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) && >> (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) { >> -- >> 1.9.5.msysgit.0 >> >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel