summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-16 01:03:16 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-16 01:03:16 +0000
commitd629c28396030c476b77e3f4c552da201e4dffe5 (patch)
treea3c62d347003a211768a404a62b96836c48ace6b
parent026e30c4bb80a73ac7c5c286711ae07b1c51108b (diff)
downloadedk2-platforms-d629c28396030c476b77e3f4c552da201e4dffe5.tar.xz
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
-rw-r--r--ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c17
1 files changed, 17 insertions, 0 deletions
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;
}