CHAR8 Char;\r
} CPSR_CHAR;\r
\r
-CPSR_CHAR gCpsrChar[] = {\r
- { 31, 'n' },\r
- { 30, 'z' },\r
- { 29, 'c' },\r
- { 28, 'v' },\r
- { 27, 'q' },\r
-\r
- { 8, 'a' },\r
- { 7, 'i' },\r
- { 6, 'f' },\r
- { 5, 't' },\r
- { 0, '?' }\r
-};\r
-\r
\r
VOID\r
CpsrString (\r
UINTN Index;\r
CHAR8 *Str = ReturnStr;\r
CHAR8 *ModeStr;\r
+ CPSR_CHAR CpsrChar[] = {\r
+ { 31, 'n' },\r
+ { 30, 'z' },\r
+ { 29, 'c' },\r
+ { 28, 'v' },\r
+\r
+ { 9, 'e' },\r
+ { 8, 'a' },\r
+ { 7, 'i' },\r
+ { 6, 'f' },\r
+ { 5, 't' },\r
+ { 0, '?' }\r
+ };\r
\r
- for (Index = 0; gCpsrChar[Index].Bit != 0; Index++, Str++) {\r
- *Str = gCpsrChar[Index].Char;\r
- if ((Cpsr & (1 << gCpsrChar[Index].Bit)) != 0) {\r
+ for (Index = 0; CpsrChar[Index].Bit != 0; Index++, Str++) {\r
+ *Str = CpsrChar[Index].Char;\r
+ if ((Cpsr & (1 << CpsrChar[Index].Bit)) != 0) {\r
// Concert to upper case if bit is set\r
*Str &= ~0x20;\r
}\r
// you need to subtact out the size of the PE/COFF header to get\r
// get the offset that matches the link map. \r
//\r
- DEBUG ((EFI_D_ERROR, "loadded at 0x%08x (PE/COFF offset) 0x%x (ELF or Mach-O offset) 0x%x", ImageBase, Offset, Offset - PeCoffSizeOfHeader));\r
+ DEBUG ((EFI_D_ERROR, "loaded at 0x%08x (PE/COFF offset) 0x%x (ELF or Mach-O offset) 0x%x", ImageBase, Offset, Offset - PeCoffSizeOfHeader));\r
+ \r
+ // If we come from an image it is safe to show the instruction. We know it should not fault\r
+ if ((SystemContext.SystemContextArm->CPSR & 0x20) == 0) {\r
+ // ARM\r
+ DEBUG ((EFI_D_ERROR, "\nFaulting Instruction 0x%08x", *(UINT32 *)(UINTN)SystemContext.SystemContextArm->PC));\r
+ } else {\r
+ // Thumb\r
+ DEBUG ((EFI_D_ERROR, "\nFaulting Instruction 0x%04x", *(UINT16 *)(UINTN)SystemContext.SystemContextArm->PC));\r
+ }\r
}\r
DEBUG_CODE_END ();\r
DEBUG ((EFI_D_ERROR, "\n R0 0x%08x R1 0x%08x R2 0x%08x R3 0x%08x\n", SystemContext.SystemContextArm->R0, SystemContext.SystemContextArm->R1, SystemContext.SystemContextArm->R2, SystemContext.SystemContextArm->R3));\r