From d629c28396030c476b77e3f4c552da201e4dffe5 Mon Sep 17 00:00:00 2001 From: andrewfish Date: Tue, 16 Feb 2010 01:03:16 +0000 Subject: After the ASSERT adjust the PC so you skip the faulting instruction. Lets you walk out of the exception handler and keeprunning code. This way you can walk out of the call stack. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10010 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DefaultExceptionHandler.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ArmPkg') diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c index 86d1c7cec6..e146ac0c4a 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c @@ -225,6 +225,7 @@ DefaultExceptionHandler ( { UINT32 DfsrStatus; BOOLEAN DfsrWrite; + UINT32 PcAdjust = 0; DEBUG ((EFI_D_ERROR, "\n%a Exception PC at 0x%08x CPSR 0x%08x ", gExceptionTypeString[ExceptionType], SystemContext.SystemContextArm->PC, SystemContext.SystemContextArm->CPSR)); DEBUG_CODE_BEGIN (); @@ -260,6 +261,19 @@ DefaultExceptionHandler ( ItBlock = 0; DisassembleInstruction (&DisAsm, (SystemContext.SystemContextArm->CPSR & BIT5) == BIT5, TRUE, &ItBlock, Buffer, sizeof (Buffer)); DEBUG ((EFI_D_ERROR, "\n%a", Buffer)); + + switch (ExceptionType) { + case EXCEPT_ARM_UNDEFINED_INSTRUCTION: + case EXCEPT_ARM_SOFTWARE_INTERRUPT: + case EXCEPT_ARM_PREFETCH_ABORT: + case EXCEPT_ARM_DATA_ABORT: + // advance PC past the faulting instruction + PcAdjust = (UINTN)DisAsm - SystemContext.SystemContextArm->PC; + break; + + default: + break; + } } DEBUG_CODE_END (); @@ -281,6 +295,9 @@ DefaultExceptionHandler ( DEBUG ((EFI_D_ERROR, "\n")); ASSERT (FALSE); + + // If some one is stepping past the exception handler adjust the PC to point to the next instruction + SystemContext.SystemContextArm->PC += PcAdjust; } -- cgit v1.2.3