/** @file\r
x64 CPU Exception Handler.\r
\r
- Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>\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
@param SystemContext Pointer to EFI_SYSTEM_CONTEXT.\r
**/\r
VOID\r
-DumpCpuContent (\r
+EFIAPI\r
+DumpCpuContext (\r
IN EFI_EXCEPTION_TYPE ExceptionType,\r
IN EFI_SYSTEM_CONTEXT SystemContext\r
)\r
{\r
- UINTN ImageBase;\r
- UINTN EntryPoint;\r
-\r
InternalPrintMessage (\r
"!!!! X64 Exception Type - %02x(%a) CPU Apic ID - %08x !!!!\n",\r
ExceptionType,\r
GetExceptionNameStr (ExceptionType),\r
GetApicId ()\r
);\r
-\r
+ if ((mErrorCodeFlag & (1 << ExceptionType)) != 0) {\r
+ InternalPrintMessage (\r
+ "ExceptionData - %016lx",\r
+ SystemContext.SystemContextX64->ExceptionData\r
+ );\r
+ if (ExceptionType == EXCEPT_IA32_PAGE_FAULT) {\r
+ InternalPrintMessage (\r
+ " I:%x R:%x U:%x W:%x P:%x PK:%x S:%x",\r
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0,\r
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_RSVD) != 0,\r
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_US) != 0,\r
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_WR) != 0,\r
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_P) != 0,\r
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_PK) != 0,\r
+ (SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_SGX) != 0\r
+ );\r
+ }\r
+ InternalPrintMessage ("\n");\r
+ }\r
InternalPrintMessage (\r
"RIP - %016lx, CS - %016lx, RFLAGS - %016lx\n",\r
SystemContext.SystemContextX64->Rip,\r
SystemContext.SystemContextX64->Cs,\r
SystemContext.SystemContextX64->Rflags\r
);\r
- if (mErrorCodeFlag & (1 << ExceptionType)) {\r
- InternalPrintMessage (\r
- "ExceptionData - %016lx\n",\r
- SystemContext.SystemContextX64->ExceptionData\r
- );\r
- }\r
InternalPrintMessage (\r
"RAX - %016lx, RCX - %016lx, RDX - %016lx\n",\r
SystemContext.SystemContextX64->Rax,\r
"FXSAVE_STATE - %016lx\n",\r
&SystemContext.SystemContextX64->FxSaveState\r
);\r
+}\r
\r
+/**\r
+ Display CPU information.\r
+\r
+ @param ExceptionType Exception type.\r
+ @param SystemContext Pointer to EFI_SYSTEM_CONTEXT.\r
+**/\r
+VOID\r
+DumpImageAndCpuContent (\r
+ IN EFI_EXCEPTION_TYPE ExceptionType,\r
+ IN EFI_SYSTEM_CONTEXT SystemContext\r
+ )\r
+{\r
+ DumpCpuContext (ExceptionType, SystemContext);\r
//\r
- // Find module image base and module entry point by RIP\r
+ // Dump module image base and module entry point by RIP\r
//\r
- ImageBase = FindModuleImageBase (SystemContext.SystemContextX64->Rip, &EntryPoint);\r
- if (ImageBase != 0) {\r
- InternalPrintMessage (\r
- " (ImageBase=%016lx, EntryPoint=%016lx) !!!!\n",\r
- ImageBase,\r
- EntryPoint\r
- );\r
- }\r
+ DumpModuleImageInfo (SystemContext.SystemContextX64->Rip);\r
}\r