TianoCore EDK2 master
|
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/PrintLib.h>
#include <Library/ArmDisassemblerLib.h>
#include <Library/SerialPortLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Guid/DebugImageInfoTable.h>
#include <Protocol/DebugSupport.h>
#include <Library/DefaultExceptionHandlerLib.h>
Go to the source code of this file.
Data Structures | |
struct | CPSR_CHAR |
Macros | |
#define | MAX_PRINT_CHARS 100 |
#define | CPSR_STRING_SIZE 32 |
Functions | |
CHAR8 * | GetImageName (IN UINTN FaultAddress, OUT UINTN *ImageBase, OUT UINTN *PeCoffSizeOfHeaders) |
VOID | CpsrString (IN UINT32 Cpsr, OUT CHAR8 *ReturnStr) |
CHAR8 * | FaultStatusToString (IN UINT32 Status) |
VOID | DefaultExceptionHandler (IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext) |
Variables | |
STATIC CONST CPSR_CHAR | mCpsrChar [] |
STATIC CHAR8 * | gExceptionTypeString [] |
Default exception handler
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
Copyright (c) 2012 - 2021, Arm Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DefaultExceptionHandler.c.
#define CPSR_STRING_SIZE 32 |
Definition at line 36 of file DefaultExceptionHandler.c.
#define MAX_PRINT_CHARS 100 |
Definition at line 30 of file DefaultExceptionHandler.c.
Convert the Current Program Status Register (CPSR) to a string. The string is a defacto standard in the ARM world.
It is possible to add extra bits by adding them to mCpsrChar array.
Cpsr | ARM CPSR register value |
ReturnStr | CPSR_STRING_SIZE byte string that contains string version of CPSR |
Definition at line 76 of file DefaultExceptionHandler.c.
VOID DefaultExceptionHandler | ( | IN EFI_EXCEPTION_TYPE | ExceptionType, |
IN OUT EFI_SYSTEM_CONTEXT | SystemContext | ||
) |
This is the default action to take on an unexpected exception
Since this is exception context don't do anything crazy like try to allocate memory.
ExceptionType | Type of the exception |
SystemContext | Register state at the time of the Exception |
Definition at line 202 of file DefaultExceptionHandler.c.
CHAR8 * FaultStatusToString | ( | IN UINT32 | Status | ) |
Definition at line 136 of file DefaultExceptionHandler.c.
CHAR8 * GetImageName | ( | IN UINTN | FaultAddress, |
OUT UINTN * | ImageBase, | ||
OUT UINTN * | PeCoffSizeOfHeaders | ||
) |
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.
FaultAddress | Address to find PE/COFF image for. |
ImageBase | Return load address of found image |
PeCoffSizeOfHeaders | Return the size of the PE/COFF header for the image that was found |
NULL | FaultAddress not in a loaded PE/COFF image. |
Path | and file name of PE/COFF image. |
Definition at line 30 of file DefaultExceptionHandlerUefi.c.
STATIC CHAR8* gExceptionTypeString[] |
Definition at line 180 of file DefaultExceptionHandler.c.
Definition at line 43 of file DefaultExceptionHandler.c.