summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authorOliver Smith-Denny <osde@linux.microsoft.com>2023-08-02 11:59:28 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-08-03 14:43:08 +0000
commitef051451367fa5455d75b38c407ca352a43b4849 (patch)
tree382bcaeb13907bcabf0aa7d02dd8ff32e6fa0056 /ArmPlatformPkg
parent7672d1cca58228b0cb7f099e8863aa3a44ae45db (diff)
downloadedk2-ef051451367fa5455d75b38c407ca352a43b4849.tar.gz
edk2-ef051451367fa5455d75b38c407ca352a43b4849.tar.bz2
edk2-ef051451367fa5455d75b38c407ca352a43b4849.zip
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>
Diffstat (limited to 'ArmPlatformPkg')
0 files changed, 0 insertions, 0 deletions