public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io
Cc: quic_llindhol@quicinc.com, maz@kernel.org,
	Ard Biesheuvel <ardb@kernel.org>
Subject: [PATCH] ArmPkg/DefaultExceptionHandler: Dump ESR and FAR in RELEASE builds
Date: Fri, 27 Jan 2023 18:42:23 +0100	[thread overview]
Message-ID: <20230127174223.1267942-1-ardb@kernel.org> (raw)

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


                 reply	other threads:[~2023-01-27 17:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230127174223.1267942-1-ardb@kernel.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox