From nobody Fri May 17 00:20:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+99195+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+99195+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1674841357; cv=none; d=zohomail.com; s=zohoarc; b=FtxOLTQZV/bOeGTOOmlsdcwuVo3tmzLR+8Os6ARAY+hqK1FJvaWFwPax9/y4eB8eibhq6whTsBOsas2nGnBY5RrcrBV8cEXYPezdqlRBy3tAvTeYz39jCz7s666CScaTCJJVv7Jme0g6qPNNjgLy45+pr088N4s6/t33DsSYBrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674841357; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=Ev6/p8+YIfzxqIKy2zNrbCdTKgqdq/aZjuc7hNM30HQ=; b=hOfzwFgLE0BnEgkevZM1P0ebE8KsoCvAXOdSajJzl8lWGGC/l6+7dN+DF4ymcd+50ZRnZFmDHTHSob0ZzBMA6lTgvm6k0sw4ijzUSSgK8tYpCjKoHvus+VzCUlBXvLCiBvjqMBXtX6GPFacvh98KODC+6ru+QX8BTATjGvGcgyI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+99195+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1674841357155584.2133500808272; Fri, 27 Jan 2023 09:42:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fUCXYY1788612x7q4NhDJ6yC; Fri, 27 Jan 2023 09:42:36 -0800 X-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 X-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) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC679C4339E; Fri, 27 Jan 2023 17:42:31 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, maz@kernel.org, Ard Biesheuvel Subject: [edk2-devel] [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> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: Wcru6mLIIkH6lLm8LoKz7ga3x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1674841356; bh=NwRMvKExBWBwPkOYBSPCXRTdySHyZtUfXFz/Eqv111I=; h=Cc:Date:From:Reply-To:Subject:To; b=pFim+I2wjkOkBzG9oxr9w42xewiCERl+mS7FNjdZGcJaQLpsbrCiiE1XpkBi1nJtkBF jVn4hj93ve6RZP6qP1lfOOBjGqv8BhtbdI5072CB8clTKIojVz0uGy2zflnciOBCZ0mv7 U75cN7sYXVVXrhH9KEJu/F0nTPT54QEc7WM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1674841358894100002 Content-Type: text/plain; charset="utf-8" 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 ( =20 mRecursiveException =3D TRUE; =20 - CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n\n%a Exception at= 0x%016lx\n", gExceptionTypeString[ExceptionType], SystemContext.SystemCont= extAArch64->ELR); + CharCount =3D 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 !=3D NULL) { AsciiPrint (Buffer); --=20 2.39.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99195): https://edk2.groups.io/g/devel/message/99195 Mute This Topic: https://groups.io/mt/96571451/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-