ArmPkg: DefaultExceptionHandler fixes for use with DxeCore
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>
This commit is contained in:
committed by
Ard Biesheuvel
parent
0b6249f590
commit
82ea9a6b59
@@ -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,24 @@ 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;
|
||||
|
||||
DebugTable = gDebugImageTableHeader->EfiDebugImageInfoTable;
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiDebugImageInfoTableGuid, (VOID **)&DebugTableHeader);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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)) {
|
||||
|
Reference in New Issue
Block a user