]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandler.c
After the ASSERT adjust the PC so you skip the faulting instruction. Lets you walk...
[mirror_edk2.git] / ArmPkg / Library / DefaultExceptionHandlerLib / DefaultExceptionHandler.c
index 86d1c7cec65df654591c465ef93bcab1541eda1f..e146ac0c4a38cb9ca29e2ba661f43cad7aca842a 100644 (file)
@@ -225,6 +225,7 @@ DefaultExceptionHandler (
 {\r
   UINT32    DfsrStatus;\r
   BOOLEAN   DfsrWrite;\r
+  UINT32    PcAdjust = 0;\r
 \r
   DEBUG ((EFI_D_ERROR, "\n%a Exception PC at 0x%08x  CPSR 0x%08x ", gExceptionTypeString[ExceptionType], SystemContext.SystemContextArm->PC, SystemContext.SystemContextArm->CPSR));\r
   DEBUG_CODE_BEGIN ();\r
@@ -260,6 +261,19 @@ DefaultExceptionHandler (
       ItBlock = 0;\r
       DisassembleInstruction (&DisAsm, (SystemContext.SystemContextArm->CPSR & BIT5) == BIT5, TRUE, &ItBlock, Buffer, sizeof (Buffer));\r
       DEBUG ((EFI_D_ERROR, "\n%a", Buffer));\r
+      \r
+      switch (ExceptionType) {\r
+      case EXCEPT_ARM_UNDEFINED_INSTRUCTION:\r
+      case EXCEPT_ARM_SOFTWARE_INTERRUPT:\r
+      case EXCEPT_ARM_PREFETCH_ABORT:\r
+      case EXCEPT_ARM_DATA_ABORT:\r
+        // advance PC past the faulting instruction\r
+        PcAdjust = (UINTN)DisAsm - SystemContext.SystemContextArm->PC;\r
+        break;\r
+      \r
+      default:\r
+        break;\r
+      }\r
 \r
     }\r
   DEBUG_CODE_END ();\r
@@ -281,6 +295,9 @@ DefaultExceptionHandler (
 \r
   DEBUG ((EFI_D_ERROR, "\n"));\r
   ASSERT (FALSE);\r
+  \r
+  // If some one is stepping past the exception handler adjust the PC to point to the next instruction \r
+  SystemContext.SystemContextArm->PC += PcAdjust;\r
 }\r
 \r
 \r