summaryrefslogtreecommitdiff
path: root/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c')
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c84
1 files changed, 5 insertions, 79 deletions
diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c
index 94aacf83a4..bb29b95da2 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c
@@ -2,6 +2,7 @@
Default exception handler
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
+ Copyright (c) 2012, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -14,7 +15,6 @@
**/
#include <Uefi.h>
-#include <Library/UefiLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
@@ -23,67 +23,23 @@
#include <Library/SerialPortLib.h>
#include <Guid/DebugImageInfoTable.h>
-#include <Protocol/DebugSupport.h>
-#include <Protocol/LoadedImage.h>
+#include <Protocol/DebugSupport.h>
+#include <Library/DefaultExceptionHandlerLib.h>
EFI_DEBUG_IMAGE_INFO_TABLE_HEADER *gDebugImageTableHeader = NULL;
-
typedef struct {
UINT32 BIT;
CHAR8 Char;
} CPSR_CHAR;
-
-/**
- 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
- string can be returned. For ELF and Mach-O images the string points to the Mach-O or ELF
- image. Microsoft tools contain a pointer to the PDB file that contains the debug information.
-
- @param FaultAddress Address to find PE/COFF image for.
- @param ImageBase Return load address of found image
- @param PeCoffSizeOfHeaders Return the size of the PE/COFF header for the image that was found
-
- @retval NULL FaultAddress not in a loaded PE/COFF image.
- @retval Path and file name of PE/COFF image.
-
-**/
CHAR8 *
GetImageName (
IN UINT32 FaultAddress,
OUT UINT32 *ImageBase,
OUT UINT32 *PeCoffSizeOfHeaders
- )
-{
- EFI_DEBUG_IMAGE_INFO *DebugTable;
- UINTN Entry;
- CHAR8 *Address;
-
- DebugTable = gDebugImageTableHeader->EfiDebugImageInfoTable;
- if (DebugTable == NULL) {
- return NULL;
- }
-
- Address = (CHAR8 *)(UINTN)FaultAddress;
- for (Entry = 0; Entry < gDebugImageTableHeader->TableSize; Entry++, DebugTable++) {
- if (DebugTable->NormalImage != NULL) {
- if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
- (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
- if ((Address >= (CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) &&
- (Address <= ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {
- *ImageBase = (UINT32)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;
- *PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)*ImageBase);
- return PeCoffLoaderGetPdbPointer (DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase);
- }
- }
- }
- }
-
- return NULL;
-}
-
+ );
/**
Convert the Current Program Status Register (CPSR) to a string. The string is
@@ -198,7 +154,7 @@ FaultStatusToString (
STATIC CHAR8 *gExceptionTypeString[] = {
"Reset",
"Undefined OpCode",
- "SWI",
+ "SVC",
"Prefetch Abort",
"Data Abort",
"Undefined",
@@ -310,33 +266,3 @@ DefaultExceptionHandler (
// If some one is stepping past the exception handler adjust the PC to point to the next instruction
SystemContext.SystemContextArm->PC += PcAdjust;
}
-
-
-
-
-/**
- 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;
-}