From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.108665.1674841355947027352 for ; Fri, 27 Jan 2023 09:42:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YCho+6yx; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2AFA3B8214D; Fri, 27 Jan 2023 17:42:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC679C4339E; Fri, 27 Jan 2023 17:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674841352; bh=4k87WwX3/JeoN2Gr2Td68x7SoFt+8ckNm0AMW3PjbMI=; h=From:To:Cc:Subject:Date:From; b=YCho+6yxTxETfkgbFvjBaNQ/jwxNteEjBfgHfELxEwuaey3UZtojM6XFw38cxAGbr ejsoXoGL6rw/Z7y5Oz1I0YHzV8+n2ovLBpGcmyzLzVaFZKAIGzgb2C18SybkfCJIeP gATBUYqJiT9kXVK7FTpu7OR/vZMoh20UlAJIiFR1ilSZoTwm5D26XvitcWXFttWu5A hcaCcnRH9TUd/5Y8lJnaOLW2rXRAC4HSeec8HAvGdM3wS4ZG+ZRT72usXV12LQY1V4 pOb4TctSZtplgjhjZ+gOzdw1mG4BQPRVdrW/5k3/R/RvXU4HPcNCgEPXeWDxHzoKZh iybiIFSgdhi9Q== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, maz@kernel.org, Ard Biesheuvel Subject: [PATCH] ArmPkg/DefaultExceptionHandler: Dump ESR and FAR in RELEASE builds Date: Fri, 27 Jan 2023 18:42:23 +0100 Message-Id: <20230127174223.1267942-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- .../AArch64/DefaultExceptionHandler.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExcep= tionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultEx= ceptionHandler.c index f2bca5d74005..f557b1e78bde 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHan= dler.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHan= dler.c @@ -205,7 +205,13 @@ DefaultExceptionHandler ( =0D mRecursiveException =3D TRUE;=0D =0D - CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n\n%a Exception at= 0x%016lx\n", gExceptionTypeString[ExceptionType], SystemContext.SystemCont= extAArch64->ELR);=0D + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer),=0D + "\n\n%a Exception at 0x%016lx, ESR:0x%016lx FAR:0x%016lx\n= ",=0D + gExceptionTypeString[ExceptionType],=0D + SystemContext.SystemContextAArch64->ELR,=0D + SystemContext.SystemContextAArch64->ESR,=0D + SystemContext.SystemContextAArch64->FAR=0D + );=0D SerialPortWrite ((UINT8 *)Buffer, CharCount);=0D if (gST->ConOut !=3D NULL) {=0D AsciiPrint (Buffer);=0D --=20 2.39.0