audk/ArmPkg/Library/DefaultExceptionHandlerLib
Oliver Smith-Denny ef05145136 ArmPkg: DefaultExceptionHandlerLib: Do Not Allocate Memory
If gST->ConOut is available when Arm's DefaultExceptionHandler is
running, AsciiPrint will get called to attempt to print to ConOut, in
addition to the serial output.

AsciiPrint calls AsciiInternalPrint in UefiLibPrint.c which in turn
calls AllocatePool to allocate a buffer to convert the Ascii input
string to a Unicode string to pass to ConOut->OutputString.

Per the comment on DefaultExceptionHandler, we should not be allocating
memory in the exception handler, as this can cause the exception handler
to fail if we had a memory exception or the system state is such that we
cannot allocate memory.

It has been observed on ArmVirtQemu that exceptions generated in the
memory handling code will fail to output the stack dump and CPU state
that is critical to debugging because the AllocatePool will fail.

This patch fixes the Arm and AARCH64 DefaultExceptionHandlers to not
allocate memory when ConOut is available and instead use stack memory to
convert the Ascii string needed for SerialPortWrite to the Unicode
string needed for ConOut->OutputString. Correspondingly, ArmVirtQemu can
now output the stack dump and CPU state when hitting an exception in
memory code.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2023-08-03 14:43:08 +00:00
..
AArch64 ArmPkg: DefaultExceptionHandlerLib: Do Not Allocate Memory 2023-08-03 14:43:08 +00:00
Arm ArmPkg: DefaultExceptionHandlerLib: Do Not Allocate Memory 2023-08-03 14:43:08 +00:00
DefaultExceptionHandlerLib.inf ArmPkg: Replace BSD License with BSD+Patent License 2019-04-09 09:10:21 -07:00
DefaultExceptionHandlerUefi.c ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00