Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>\r
\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include <Library/PrintLib.h>\r
#include <Library/ArmDisassemblerLib.h>\r
#include <Library/SerialPortLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
\r
#include <Guid/DebugImageInfoTable.h>\r
#include <Protocol/DebugSupport.h>\r
#include <Protocol/LoadedImage.h>\r
\r
-STATIC CHAR8 *gExceptionTypeString[] = {\r
+STATIC CHAR8 *gExceptionTypeString[] = {\r
"Synchronous",\r
"IRQ",\r
"FIQ",\r
"SError"\r
};\r
\r
+STATIC BOOLEAN mRecursiveException;\r
+\r
CHAR8 *\r
GetImageName (\r
IN UINTN FaultAddress,\r
STATIC\r
VOID\r
DescribeInstructionOrDataAbort (\r
- IN CHAR8 *AbortType,\r
- IN UINTN Iss\r
+ IN CHAR8 *AbortType,\r
+ IN UINTN Iss\r
)\r
{\r
- CHAR8 *AbortCause;\r
+ CHAR8 *AbortCause;\r
\r
switch (Iss & 0x3f) {\r
- case 0x0: AbortCause = "Address size fault, zeroth level of translation or translation table base register"; break;\r
- case 0x1: AbortCause = "Address size fault, first level"; break;\r
- case 0x2: AbortCause = "Address size fault, second level"; break;\r
- case 0x3: AbortCause = "Address size fault, third level"; break;\r
- case 0x4: AbortCause = "Translation fault, zeroth level"; break;\r
- case 0x5: AbortCause = "Translation fault, first level"; break;\r
- case 0x6: AbortCause = "Translation fault, second level"; break;\r
- case 0x7: AbortCause = "Translation fault, third level"; break;\r
- case 0x9: AbortCause = "Access flag fault, first level"; break;\r
- case 0xa: AbortCause = "Access flag fault, second level"; break;\r
- case 0xb: AbortCause = "Access flag fault, third level"; break;\r
- case 0xd: AbortCause = "Permission fault, first level"; break;\r
- case 0xe: AbortCause = "Permission fault, second level"; break;\r
- case 0xf: AbortCause = "Permission fault, third level"; break;\r
- case 0x10: AbortCause = "Synchronous external abort"; break;\r
- case 0x18: AbortCause = "Synchronous parity error on memory access"; break;\r
- case 0x11: AbortCause = "Asynchronous external abort"; break;\r
- case 0x19: AbortCause = "Asynchronous parity error on memory access"; break;\r
- case 0x14: AbortCause = "Synchronous external abort on translation table walk, zeroth level"; break;\r
- case 0x15: AbortCause = "Synchronous external abort on translation table walk, first level"; break;\r
- case 0x16: AbortCause = "Synchronous external abort on translation table walk, second level"; break;\r
- case 0x17: AbortCause = "Synchronous external abort on translation table walk, third level"; break;\r
- case 0x1c: AbortCause = "Synchronous parity error on memory access on translation table walk, zeroth level"; break;\r
- case 0x1d: AbortCause = "Synchronous parity error on memory access on translation table walk, first level"; break;\r
- case 0x1e: AbortCause = "Synchronous parity error on memory access on translation table walk, second level"; break;\r
- case 0x1f: AbortCause = "Synchronous parity error on memory access on translation table walk, third level"; break;\r
- case 0x21: AbortCause = "Alignment fault"; break;\r
- case 0x22: AbortCause = "Debug event"; break;\r
- case 0x30: AbortCause = "TLB conflict abort"; break;\r
+ case 0x0: AbortCause = "Address size fault, zeroth level of translation or translation table base register";\r
+ break;\r
+ case 0x1: AbortCause = "Address size fault, first level";\r
+ break;\r
+ case 0x2: AbortCause = "Address size fault, second level";\r
+ break;\r
+ case 0x3: AbortCause = "Address size fault, third level";\r
+ break;\r
+ case 0x4: AbortCause = "Translation fault, zeroth level";\r
+ break;\r
+ case 0x5: AbortCause = "Translation fault, first level";\r
+ break;\r
+ case 0x6: AbortCause = "Translation fault, second level";\r
+ break;\r
+ case 0x7: AbortCause = "Translation fault, third level";\r
+ break;\r
+ case 0x9: AbortCause = "Access flag fault, first level";\r
+ break;\r
+ case 0xa: AbortCause = "Access flag fault, second level";\r
+ break;\r
+ case 0xb: AbortCause = "Access flag fault, third level";\r
+ break;\r
+ case 0xd: AbortCause = "Permission fault, first level";\r
+ break;\r
+ case 0xe: AbortCause = "Permission fault, second level";\r
+ break;\r
+ case 0xf: AbortCause = "Permission fault, third level";\r
+ break;\r
+ case 0x10: AbortCause = "Synchronous external abort";\r
+ break;\r
+ case 0x18: AbortCause = "Synchronous parity error on memory access";\r
+ break;\r
+ case 0x11: AbortCause = "Asynchronous external abort";\r
+ break;\r
+ case 0x19: AbortCause = "Asynchronous parity error on memory access";\r
+ break;\r
+ case 0x14: AbortCause = "Synchronous external abort on translation table walk, zeroth level";\r
+ break;\r
+ case 0x15: AbortCause = "Synchronous external abort on translation table walk, first level";\r
+ break;\r
+ case 0x16: AbortCause = "Synchronous external abort on translation table walk, second level";\r
+ break;\r
+ case 0x17: AbortCause = "Synchronous external abort on translation table walk, third level";\r
+ break;\r
+ case 0x1c: AbortCause = "Synchronous parity error on memory access on translation table walk, zeroth level";\r
+ break;\r
+ case 0x1d: AbortCause = "Synchronous parity error on memory access on translation table walk, first level";\r
+ break;\r
+ case 0x1e: AbortCause = "Synchronous parity error on memory access on translation table walk, second level";\r
+ break;\r
+ case 0x1f: AbortCause = "Synchronous parity error on memory access on translation table walk, third level";\r
+ break;\r
+ case 0x21: AbortCause = "Alignment fault";\r
+ break;\r
+ case 0x22: AbortCause = "Debug event";\r
+ break;\r
+ case 0x30: AbortCause = "TLB conflict abort";\r
+ break;\r
case 0x33:\r
- case 0x34: AbortCause = "IMPLEMENTATION DEFINED"; break;\r
+ case 0x34: AbortCause = "IMPLEMENTATION DEFINED";\r
+ break;\r
case 0x35:\r
- case 0x36: AbortCause = "Domain fault"; break;\r
- default: AbortCause = ""; break;\r
+ case 0x36: AbortCause = "Domain fault";\r
+ break;\r
+ default: AbortCause = "";\r
+ break;\r
}\r
\r
- DEBUG ((EFI_D_ERROR, "\n%a: %a\n", AbortType, AbortCause));\r
+ DEBUG ((DEBUG_ERROR, "\n%a: %a\n", AbortType, AbortCause));\r
}\r
\r
STATIC\r
VOID\r
DescribeExceptionSyndrome (\r
- IN UINT32 Esr\r
+ IN UINT32 Esr\r
)\r
{\r
- CHAR8 *Message;\r
- UINTN Ec;\r
- UINTN Iss;\r
+ CHAR8 *Message;\r
+ UINTN Ec;\r
+ UINTN Iss;\r
\r
- Ec = Esr >> 26;\r
+ Ec = Esr >> 26;\r
Iss = Esr & 0x00ffffff;\r
\r
switch (Ec) {\r
- case 0x15: Message = "SVC executed in AArch64"; break;\r
+ case 0x15: Message = "SVC executed in AArch64";\r
+ break;\r
case 0x20:\r
- case 0x21: DescribeInstructionOrDataAbort ("Instruction abort", Iss); return;\r
- case 0x22: Message = "PC alignment fault"; break;\r
- case 0x23: Message = "SP alignment fault"; break;\r
+ case 0x21: DescribeInstructionOrDataAbort ("Instruction abort", Iss);\r
+ return;\r
+ case 0x22: Message = "PC alignment fault";\r
+ break;\r
+ case 0x23: Message = "SP alignment fault";\r
+ break;\r
case 0x24:\r
- case 0x25: DescribeInstructionOrDataAbort ("Data abort", Iss); return;\r
+ case 0x25: DescribeInstructionOrDataAbort ("Data abort", Iss);\r
+ return;\r
default: return;\r
}\r
\r
- DEBUG ((EFI_D_ERROR, "\n %a \n", Message));\r
+ DEBUG ((DEBUG_ERROR, "\n %a \n", Message));\r
}\r
\r
+#ifndef MDEPKG_NDEBUG\r
+STATIC\r
+CONST CHAR8 *\r
+BaseName (\r
+ IN CONST CHAR8 *FullName\r
+ )\r
+{\r
+ CONST CHAR8 *Str;\r
+\r
+ Str = FullName + AsciiStrLen (FullName);\r
+\r
+ while (--Str > FullName) {\r
+ if ((*Str == '/') || (*Str == '\\')) {\r
+ return Str + 1;\r
+ }\r
+ }\r
+\r
+ return Str;\r
+}\r
+\r
+#endif\r
+\r
/**\r
This is the default action to take on an unexpected exception\r
\r
- Since this is exception context don't do anything crazy like try to allcoate memory.\r
+ Since this is exception context don't do anything crazy like try to allocate memory.\r
\r
@param ExceptionType Type of the exception\r
@param SystemContext Register state at the time of the Exception\r
**/\r
VOID\r
DefaultExceptionHandler (\r
- IN EFI_EXCEPTION_TYPE ExceptionType,\r
- IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
+ IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
)\r
{\r
CHAR8 Buffer[100];\r
UINTN CharCount;\r
+ INT32 Offset;\r
+\r
+ if (mRecursiveException) {\r
+ STATIC CHAR8 CONST Message[] = "\nRecursive exception occurred while dumping the CPU state\n";\r
+\r
+ SerialPortWrite ((UINT8 *)Message, sizeof Message - 1);\r
+ if (gST->ConOut != NULL) {\r
+ AsciiPrint (Message);\r
+ }\r
+\r
+ CpuDeadLoop ();\r
+ }\r
+\r
+ mRecursiveException = TRUE;\r
\r
- CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"\n\n%a Exception at 0x%016lx\n", gExceptionTypeString[ExceptionType], SystemContext.SystemContextAArch64->ELR);\r
- SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
+ CharCount = AsciiSPrint (Buffer, sizeof (Buffer), "\n\n%a Exception at 0x%016lx\n", gExceptionTypeString[ExceptionType], SystemContext.SystemContextAArch64->ELR);\r
+ SerialPortWrite ((UINT8 *)Buffer, CharCount);\r
+ if (gST->ConOut != NULL) {\r
+ AsciiPrint (Buffer);\r
+ }\r
\r
DEBUG_CODE_BEGIN ();\r
- CHAR8 *Pdb;\r
- UINTN ImageBase;\r
- UINTN PeCoffSizeOfHeader;\r
- Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader);\r
+ CHAR8 *Pdb, *PrevPdb;\r
+ UINTN ImageBase;\r
+ UINTN PeCoffSizeOfHeader;\r
+ UINT64 *Fp;\r
+ UINT64 RootFp[2];\r
+ UINTN Idx;\r
+\r
+ PrevPdb = Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader);\r
+ if (Pdb != NULL) {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "PC 0x%012lx (0x%012lx+0x%08x) [ 0] %a\n",\r
+ SystemContext.SystemContextAArch64->ELR,\r
+ ImageBase,\r
+ SystemContext.SystemContextAArch64->ELR - ImageBase,\r
+ BaseName (Pdb)\r
+ ));\r
+ } else {\r
+ DEBUG ((DEBUG_ERROR, "PC 0x%012lx\n", SystemContext.SystemContextAArch64->ELR));\r
+ }\r
+\r
+ if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) {\r
+ Idx = 0;\r
+\r
+ RootFp[0] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[0];\r
+ RootFp[1] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[1];\r
+ if (RootFp[1] != SystemContext.SystemContextAArch64->LR) {\r
+ RootFp[0] = SystemContext.SystemContextAArch64->FP;\r
+ RootFp[1] = SystemContext.SystemContextAArch64->LR;\r
+ }\r
+\r
+ for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) {\r
+ Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader);\r
+ if (Pdb != NULL) {\r
+ if (Pdb != PrevPdb) {\r
+ Idx++;\r
+ PrevPdb = Pdb;\r
+ }\r
+\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "PC 0x%012lx (0x%012lx+0x%08x) [% 2d] %a\n",\r
+ Fp[1],\r
+ ImageBase,\r
+ Fp[1] - ImageBase,\r
+ Idx,\r
+ BaseName (Pdb)\r
+ ));\r
+ } else {\r
+ DEBUG ((DEBUG_ERROR, "PC 0x%012lx\n", Fp[1]));\r
+ }\r
+ }\r
+\r
+ PrevPdb = Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader);\r
if (Pdb != NULL) {\r
- DEBUG ((EFI_D_ERROR, "%a loaded at 0x%016lx \n", Pdb, ImageBase));\r
+ DEBUG ((DEBUG_ERROR, "\n[ 0] %a\n", Pdb));\r
}\r
+\r
+ Idx = 0;\r
+ for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) {\r
+ Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader);\r
+ if ((Pdb != NULL) && (Pdb != PrevPdb)) {\r
+ DEBUG ((DEBUG_ERROR, "[% 2d] %a\n", ++Idx, Pdb));\r
+ PrevPdb = Pdb;\r
+ }\r
+ }\r
+ }\r
+\r
DEBUG_CODE_END ();\r
\r
- DEBUG ((EFI_D_ERROR, "\n X0 0x%016lx X1 0x%016lx X2 0x%016lx X3 0x%016lx\n", SystemContext.SystemContextAArch64->X0, SystemContext.SystemContextAArch64->X1, SystemContext.SystemContextAArch64->X2, SystemContext.SystemContextAArch64->X3));\r
- DEBUG ((EFI_D_ERROR, " X4 0x%016lx X5 0x%016lx X6 0x%016lx X7 0x%016lx\n", SystemContext.SystemContextAArch64->X4, SystemContext.SystemContextAArch64->X5, SystemContext.SystemContextAArch64->X6, SystemContext.SystemContextAArch64->X7));\r
- DEBUG ((EFI_D_ERROR, " X8 0x%016lx X9 0x%016lx X10 0x%016lx X11 0x%016lx\n", SystemContext.SystemContextAArch64->X8, SystemContext.SystemContextAArch64->X9, SystemContext.SystemContextAArch64->X10, SystemContext.SystemContextAArch64->X11));\r
- DEBUG ((EFI_D_ERROR, " X12 0x%016lx X13 0x%016lx X14 0x%016lx X15 0x%016lx\n", SystemContext.SystemContextAArch64->X12, SystemContext.SystemContextAArch64->X13, SystemContext.SystemContextAArch64->X14, SystemContext.SystemContextAArch64->X15));\r
- DEBUG ((EFI_D_ERROR, " X16 0x%016lx X17 0x%016lx X18 0x%016lx X19 0x%016lx\n", SystemContext.SystemContextAArch64->X16, SystemContext.SystemContextAArch64->X17, SystemContext.SystemContextAArch64->X18, SystemContext.SystemContextAArch64->X19));\r
- DEBUG ((EFI_D_ERROR, " X20 0x%016lx X21 0x%016lx X22 0x%016lx X23 0x%016lx\n", SystemContext.SystemContextAArch64->X20, SystemContext.SystemContextAArch64->X21, SystemContext.SystemContextAArch64->X22, SystemContext.SystemContextAArch64->X23));\r
- DEBUG ((EFI_D_ERROR, " X24 0x%016lx X25 0x%016lx X26 0x%016lx X27 0x%016lx\n", SystemContext.SystemContextAArch64->X24, SystemContext.SystemContextAArch64->X25, SystemContext.SystemContextAArch64->X26, SystemContext.SystemContextAArch64->X27));\r
- DEBUG ((EFI_D_ERROR, " X28 0x%016lx FP 0x%016lx LR 0x%016lx \n", SystemContext.SystemContextAArch64->X28, SystemContext.SystemContextAArch64->FP, SystemContext.SystemContextAArch64->LR));\r
+ DEBUG ((DEBUG_ERROR, "\n X0 0x%016lx X1 0x%016lx X2 0x%016lx X3 0x%016lx\n", SystemContext.SystemContextAArch64->X0, SystemContext.SystemContextAArch64->X1, SystemContext.SystemContextAArch64->X2, SystemContext.SystemContextAArch64->X3));\r
+ DEBUG ((DEBUG_ERROR, " X4 0x%016lx X5 0x%016lx X6 0x%016lx X7 0x%016lx\n", SystemContext.SystemContextAArch64->X4, SystemContext.SystemContextAArch64->X5, SystemContext.SystemContextAArch64->X6, SystemContext.SystemContextAArch64->X7));\r
+ DEBUG ((DEBUG_ERROR, " X8 0x%016lx X9 0x%016lx X10 0x%016lx X11 0x%016lx\n", SystemContext.SystemContextAArch64->X8, SystemContext.SystemContextAArch64->X9, SystemContext.SystemContextAArch64->X10, SystemContext.SystemContextAArch64->X11));\r
+ DEBUG ((DEBUG_ERROR, " X12 0x%016lx X13 0x%016lx X14 0x%016lx X15 0x%016lx\n", SystemContext.SystemContextAArch64->X12, SystemContext.SystemContextAArch64->X13, SystemContext.SystemContextAArch64->X14, SystemContext.SystemContextAArch64->X15));\r
+ DEBUG ((DEBUG_ERROR, " X16 0x%016lx X17 0x%016lx X18 0x%016lx X19 0x%016lx\n", SystemContext.SystemContextAArch64->X16, SystemContext.SystemContextAArch64->X17, SystemContext.SystemContextAArch64->X18, SystemContext.SystemContextAArch64->X19));\r
+ DEBUG ((DEBUG_ERROR, " X20 0x%016lx X21 0x%016lx X22 0x%016lx X23 0x%016lx\n", SystemContext.SystemContextAArch64->X20, SystemContext.SystemContextAArch64->X21, SystemContext.SystemContextAArch64->X22, SystemContext.SystemContextAArch64->X23));\r
+ DEBUG ((DEBUG_ERROR, " X24 0x%016lx X25 0x%016lx X26 0x%016lx X27 0x%016lx\n", SystemContext.SystemContextAArch64->X24, SystemContext.SystemContextAArch64->X25, SystemContext.SystemContextAArch64->X26, SystemContext.SystemContextAArch64->X27));\r
+ DEBUG ((DEBUG_ERROR, " X28 0x%016lx FP 0x%016lx LR 0x%016lx \n", SystemContext.SystemContextAArch64->X28, SystemContext.SystemContextAArch64->FP, SystemContext.SystemContextAArch64->LR));\r
\r
/* We save these as 128bit numbers, but have to print them as two 64bit numbers,\r
so swap the 64bit words to correctly represent a 128bit number. */\r
- DEBUG ((EFI_D_ERROR, "\n V0 0x%016lx %016lx V1 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V0[1], SystemContext.SystemContextAArch64->V0[0], SystemContext.SystemContextAArch64->V1[1], SystemContext.SystemContextAArch64->V1[0]));\r
- DEBUG ((EFI_D_ERROR, " V2 0x%016lx %016lx V3 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V2[1], SystemContext.SystemContextAArch64->V2[0], SystemContext.SystemContextAArch64->V3[1], SystemContext.SystemContextAArch64->V3[0]));\r
- DEBUG ((EFI_D_ERROR, " V4 0x%016lx %016lx V5 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V4[1], SystemContext.SystemContextAArch64->V4[0], SystemContext.SystemContextAArch64->V5[1], SystemContext.SystemContextAArch64->V5[0]));\r
- DEBUG ((EFI_D_ERROR, " V6 0x%016lx %016lx V7 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V6[1], SystemContext.SystemContextAArch64->V6[0], SystemContext.SystemContextAArch64->V7[1], SystemContext.SystemContextAArch64->V7[0]));\r
- DEBUG ((EFI_D_ERROR, " V8 0x%016lx %016lx V9 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V8[1], SystemContext.SystemContextAArch64->V8[0], SystemContext.SystemContextAArch64->V9[1], SystemContext.SystemContextAArch64->V9[0]));\r
- DEBUG ((EFI_D_ERROR, " V10 0x%016lx %016lx V11 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V10[1], SystemContext.SystemContextAArch64->V10[0], SystemContext.SystemContextAArch64->V11[1], SystemContext.SystemContextAArch64->V11[0]));\r
- DEBUG ((EFI_D_ERROR, " V12 0x%016lx %016lx V13 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V12[1], SystemContext.SystemContextAArch64->V12[0], SystemContext.SystemContextAArch64->V13[1], SystemContext.SystemContextAArch64->V13[0]));\r
- DEBUG ((EFI_D_ERROR, " V14 0x%016lx %016lx V15 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V14[1], SystemContext.SystemContextAArch64->V14[0], SystemContext.SystemContextAArch64->V15[1], SystemContext.SystemContextAArch64->V15[0]));\r
- DEBUG ((EFI_D_ERROR, " V16 0x%016lx %016lx V17 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V16[1], SystemContext.SystemContextAArch64->V16[0], SystemContext.SystemContextAArch64->V17[1], SystemContext.SystemContextAArch64->V17[0]));\r
- DEBUG ((EFI_D_ERROR, " V18 0x%016lx %016lx V19 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V18[1], SystemContext.SystemContextAArch64->V18[0], SystemContext.SystemContextAArch64->V19[1], SystemContext.SystemContextAArch64->V19[0]));\r
- DEBUG ((EFI_D_ERROR, " V20 0x%016lx %016lx V21 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V20[1], SystemContext.SystemContextAArch64->V20[0], SystemContext.SystemContextAArch64->V21[1], SystemContext.SystemContextAArch64->V21[0]));\r
- DEBUG ((EFI_D_ERROR, " V22 0x%016lx %016lx V23 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V22[1], SystemContext.SystemContextAArch64->V22[0], SystemContext.SystemContextAArch64->V23[1], SystemContext.SystemContextAArch64->V23[0]));\r
- DEBUG ((EFI_D_ERROR, " V24 0x%016lx %016lx V25 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V24[1], SystemContext.SystemContextAArch64->V24[0], SystemContext.SystemContextAArch64->V25[1], SystemContext.SystemContextAArch64->V25[0]));\r
- DEBUG ((EFI_D_ERROR, " V26 0x%016lx %016lx V27 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V26[1], SystemContext.SystemContextAArch64->V26[0], SystemContext.SystemContextAArch64->V27[1], SystemContext.SystemContextAArch64->V27[0]));\r
- DEBUG ((EFI_D_ERROR, " V28 0x%016lx %016lx V29 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V28[1], SystemContext.SystemContextAArch64->V28[0], SystemContext.SystemContextAArch64->V29[1], SystemContext.SystemContextAArch64->V29[0]));\r
- DEBUG ((EFI_D_ERROR, " V30 0x%016lx %016lx V31 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V30[1], SystemContext.SystemContextAArch64->V30[0], SystemContext.SystemContextAArch64->V31[1], SystemContext.SystemContextAArch64->V31[0]));\r
-\r
- DEBUG ((EFI_D_ERROR, "\n SP 0x%016lx ELR 0x%016lx SPSR 0x%08lx FPSR 0x%08lx\n ESR 0x%08lx FAR 0x%016lx\n", SystemContext.SystemContextAArch64->SP, SystemContext.SystemContextAArch64->ELR, SystemContext.SystemContextAArch64->SPSR, SystemContext.SystemContextAArch64->FPSR, SystemContext.SystemContextAArch64->ESR, SystemContext.SystemContextAArch64->FAR));\r
-\r
- DEBUG ((EFI_D_ERROR, "\n ESR : EC 0x%02x IL 0x%x ISS 0x%08x\n", (SystemContext.SystemContextAArch64->ESR & 0xFC000000) >> 26, (SystemContext.SystemContextAArch64->ESR >> 25) & 0x1, SystemContext.SystemContextAArch64->ESR & 0x1FFFFFF ));\r
+ DEBUG ((DEBUG_ERROR, "\n V0 0x%016lx %016lx V1 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V0[1], SystemContext.SystemContextAArch64->V0[0], SystemContext.SystemContextAArch64->V1[1], SystemContext.SystemContextAArch64->V1[0]));\r
+ DEBUG ((DEBUG_ERROR, " V2 0x%016lx %016lx V3 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V2[1], SystemContext.SystemContextAArch64->V2[0], SystemContext.SystemContextAArch64->V3[1], SystemContext.SystemContextAArch64->V3[0]));\r
+ DEBUG ((DEBUG_ERROR, " V4 0x%016lx %016lx V5 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V4[1], SystemContext.SystemContextAArch64->V4[0], SystemContext.SystemContextAArch64->V5[1], SystemContext.SystemContextAArch64->V5[0]));\r
+ DEBUG ((DEBUG_ERROR, " V6 0x%016lx %016lx V7 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V6[1], SystemContext.SystemContextAArch64->V6[0], SystemContext.SystemContextAArch64->V7[1], SystemContext.SystemContextAArch64->V7[0]));\r
+ DEBUG ((DEBUG_ERROR, " V8 0x%016lx %016lx V9 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V8[1], SystemContext.SystemContextAArch64->V8[0], SystemContext.SystemContextAArch64->V9[1], SystemContext.SystemContextAArch64->V9[0]));\r
+ DEBUG ((DEBUG_ERROR, " V10 0x%016lx %016lx V11 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V10[1], SystemContext.SystemContextAArch64->V10[0], SystemContext.SystemContextAArch64->V11[1], SystemContext.SystemContextAArch64->V11[0]));\r
+ DEBUG ((DEBUG_ERROR, " V12 0x%016lx %016lx V13 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V12[1], SystemContext.SystemContextAArch64->V12[0], SystemContext.SystemContextAArch64->V13[1], SystemContext.SystemContextAArch64->V13[0]));\r
+ DEBUG ((DEBUG_ERROR, " V14 0x%016lx %016lx V15 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V14[1], SystemContext.SystemContextAArch64->V14[0], SystemContext.SystemContextAArch64->V15[1], SystemContext.SystemContextAArch64->V15[0]));\r
+ DEBUG ((DEBUG_ERROR, " V16 0x%016lx %016lx V17 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V16[1], SystemContext.SystemContextAArch64->V16[0], SystemContext.SystemContextAArch64->V17[1], SystemContext.SystemContextAArch64->V17[0]));\r
+ DEBUG ((DEBUG_ERROR, " V18 0x%016lx %016lx V19 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V18[1], SystemContext.SystemContextAArch64->V18[0], SystemContext.SystemContextAArch64->V19[1], SystemContext.SystemContextAArch64->V19[0]));\r
+ DEBUG ((DEBUG_ERROR, " V20 0x%016lx %016lx V21 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V20[1], SystemContext.SystemContextAArch64->V20[0], SystemContext.SystemContextAArch64->V21[1], SystemContext.SystemContextAArch64->V21[0]));\r
+ DEBUG ((DEBUG_ERROR, " V22 0x%016lx %016lx V23 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V22[1], SystemContext.SystemContextAArch64->V22[0], SystemContext.SystemContextAArch64->V23[1], SystemContext.SystemContextAArch64->V23[0]));\r
+ DEBUG ((DEBUG_ERROR, " V24 0x%016lx %016lx V25 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V24[1], SystemContext.SystemContextAArch64->V24[0], SystemContext.SystemContextAArch64->V25[1], SystemContext.SystemContextAArch64->V25[0]));\r
+ DEBUG ((DEBUG_ERROR, " V26 0x%016lx %016lx V27 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V26[1], SystemContext.SystemContextAArch64->V26[0], SystemContext.SystemContextAArch64->V27[1], SystemContext.SystemContextAArch64->V27[0]));\r
+ DEBUG ((DEBUG_ERROR, " V28 0x%016lx %016lx V29 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V28[1], SystemContext.SystemContextAArch64->V28[0], SystemContext.SystemContextAArch64->V29[1], SystemContext.SystemContextAArch64->V29[0]));\r
+ DEBUG ((DEBUG_ERROR, " V30 0x%016lx %016lx V31 0x%016lx %016lx\n", SystemContext.SystemContextAArch64->V30[1], SystemContext.SystemContextAArch64->V30[0], SystemContext.SystemContextAArch64->V31[1], SystemContext.SystemContextAArch64->V31[0]));\r
+\r
+ DEBUG ((DEBUG_ERROR, "\n SP 0x%016lx ELR 0x%016lx SPSR 0x%08lx FPSR 0x%08lx\n ESR 0x%08lx FAR 0x%016lx\n", SystemContext.SystemContextAArch64->SP, SystemContext.SystemContextAArch64->ELR, SystemContext.SystemContextAArch64->SPSR, SystemContext.SystemContextAArch64->FPSR, SystemContext.SystemContextAArch64->ESR, SystemContext.SystemContextAArch64->FAR));\r
+\r
+ DEBUG ((DEBUG_ERROR, "\n ESR : EC 0x%02x IL 0x%x ISS 0x%08x\n", (SystemContext.SystemContextAArch64->ESR & 0xFC000000) >> 26, (SystemContext.SystemContextAArch64->ESR >> 25) & 0x1, SystemContext.SystemContextAArch64->ESR & 0x1FFFFFF));\r
\r
DescribeExceptionSyndrome (SystemContext.SystemContextAArch64->ESR);\r
+\r
+ DEBUG ((DEBUG_ERROR, "\nStack dump:\n"));\r
+ for (Offset = -256; Offset < 256; Offset += 32) {\r
+ DEBUG ((\r
+ DEBUG_ERROR,\r
+ "%c %013lx: %016lx %016lx %016lx %016lx\n",\r
+ Offset == 0 ? '>' : ' ',\r
+ SystemContext.SystemContextAArch64->SP + Offset,\r
+ *(UINT64 *)(SystemContext.SystemContextAArch64->SP + Offset),\r
+ *(UINT64 *)(SystemContext.SystemContextAArch64->SP + Offset + 8),\r
+ *(UINT64 *)(SystemContext.SystemContextAArch64->SP + Offset + 16),\r
+ *(UINT64 *)(SystemContext.SystemContextAArch64->SP + Offset + 24)\r
+ ));\r
+ }\r
+\r
ASSERT (FALSE);\r
+ CpuDeadLoop ();\r
}\r