public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPkg/DefaultExceptionHandler: Dump ESR and FAR in RELEASE builds
@ 2023-01-27 17:42 Ard Biesheuvel
  0 siblings, 0 replies; only message in thread
From: Ard Biesheuvel @ 2023-01-27 17:42 UTC (permalink / raw)
  To: devel; +Cc: quic_llindhol, maz, Ard Biesheuvel

In RELEASE builds, the AArch64 default exception handler only dumps the
exception type and the ELR, which is the value of the program counter
when the exception was taken. Given that DXE phase drivers are loaded
dynamically at arbitrary addresses, this is probably the least useful
bit of information that can be provided, and knowing the ESR and FAR
would be far more useful, as these describe the nature of the exception,
and that faulting address.

So add those to the console output. Note that these values are also
dumped along with the backtrace, register dump and stack in DEBUG
builds, but not in RELEASE builds.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 .../AArch64/DefaultExceptionHandler.c                     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
index f2bca5d74005..f557b1e78bde 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c
@@ -205,7 +205,13 @@ DefaultExceptionHandler (
 
   mRecursiveException = TRUE;
 
-  CharCount = AsciiSPrint (Buffer, sizeof (Buffer), "\n\n%a Exception at 0x%016lx\n", gExceptionTypeString[ExceptionType], SystemContext.SystemContextAArch64->ELR);
+  CharCount = AsciiSPrint (Buffer, sizeof (Buffer),
+                "\n\n%a Exception at 0x%016lx, ESR:0x%016lx FAR:0x%016lx\n",
+                gExceptionTypeString[ExceptionType],
+                SystemContext.SystemContextAArch64->ELR,
+                SystemContext.SystemContextAArch64->ESR,
+                SystemContext.SystemContextAArch64->FAR
+                );
   SerialPortWrite ((UINT8 *)Buffer, CharCount);
   if (gST->ConOut != NULL) {
     AsciiPrint (Buffer);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-27 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-27 17:42 [PATCH] ArmPkg/DefaultExceptionHandler: Dump ESR and FAR in RELEASE builds Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox