audk/ArmPkg
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
..
Application/ArmCpuInfo ArmPkg: add ArmCpuInfo EFI application 2023-04-21 18:50:05 +00:00
Drivers ArmPkg: Add Function Headers to MMU Logic 2023-07-03 14:29:32 +00:00
Filesystem/SemihostFs ArmPkg/SemihostFs: replace SetMem with ZeroMem 2023-03-09 09:45:39 +00:00
Include ArmPkg: Apply Uncrustify to Non-Compliant Files 2023-07-03 14:29:32 +00:00
Library ArmPkg: DefaultExceptionHandlerLib: Do Not Allocate Memory 2023-08-03 14:43:08 +00:00
Universal/Smbios ArmPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
ArmPkg.ci.yaml ArmPkg: Enable AuditMode for Uncrustify CI checks 2023-06-02 10:02:03 +00:00
ArmPkg.dec ArmPkg/CpuDxe: Perform preliminary NX remap of free memory 2023-05-29 16:51:01 +00:00
ArmPkg.dsc ArmPkg: MmCommunicationPei: Introduce MM communicate in PEI 2023-06-28 19:35:43 +00:00