Print the minimal 'exception occurred' message to the console as well
as to the serial port if the console is available. This makes such
messages visible on systems where the console is graphical and the
serial is not connected.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
#include <Library/PrintLib.h>\r
#include <Library/ArmDisassemblerLib.h>\r
#include <Library/SerialPortLib.h>\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
\r
#include <Guid/DebugImageInfoTable.h>\r
#include <Protocol/DebugSupport.h>\r
INT32 Offset;\r
\r
if (mRecursiveException) {\r
INT32 Offset;\r
\r
if (mRecursiveException) {\r
- CharCount = AsciiSPrint (Buffer, sizeof (Buffer),"\nRecursive exception occurred while dumping the CPU state\n");\r
- SerialPortWrite ((UINT8 *) Buffer, CharCount);\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
CpuDeadLoop ();\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
CpuDeadLoop ();\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
+ if (gST->ConOut != NULL) {\r
+ AsciiPrint (Buffer);\r
+ }\r
\r
DEBUG_CODE_BEGIN ();\r
CHAR8 *Pdb, *PrevPdb;\r
\r
DEBUG_CODE_BEGIN ();\r
CHAR8 *Pdb, *PrevPdb;\r
#include <Library/PrintLib.h>\r
#include <Library/ArmDisassemblerLib.h>\r
#include <Library/SerialPortLib.h>\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
\r
\r
#include <Guid/DebugImageInfoTable.h>\r
\r
\r
CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"\n%a Exception PC at 0x%08x CPSR 0x%08x ",\r
gExceptionTypeString[ExceptionType], SystemContext.SystemContextArm->PC, SystemContext.SystemContextArm->CPSR);\r
\r
CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"\n%a Exception PC at 0x%08x CPSR 0x%08x ",\r
gExceptionTypeString[ExceptionType], SystemContext.SystemContextArm->PC, SystemContext.SystemContextArm->CPSR);\r
- SerialPortWrite ((UINT8 *) Buffer, CharCount);\r
+ SerialPortWrite ((UINT8 *)Buffer, CharCount);\r
+ if (gST->ConOut != NULL) {\r
+ AsciiPrint (Buffer);\r
+ }\r
\r
DEBUG_CODE_BEGIN ();\r
CHAR8 *Pdb;\r
\r
DEBUG_CODE_BEGIN ();\r
CHAR8 *Pdb;\r
PeCoffGetEntryPointLib\r
ArmDisassemblerLib\r
SerialPortLib\r
PeCoffGetEntryPointLib\r
ArmDisassemblerLib\r
SerialPortLib\r
+ UefiBootServicesTableLib\r
\r
[Guids]\r
gEfiDebugImageInfoTableGuid\r
\r
[Guids]\r
gEfiDebugImageInfoTableGuid\r