From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5414B941E04 for ; Sun, 11 Feb 2024 23:10:45 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=lV7fTI3cmjS25gVmgqcVH7oqBukm8r9jJj49D5HyZ6o=; c=relaxed/simple; d=groups.io; h=Feedback-ID:Message-ID:Date:MIME-Version:User-Agent:Subject:To:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1707693043; v=1; b=aDQA+FCdqOBZm8939KVWpuKnYiPi76E8SuIqc1YQD6r3gKcYeDjOoUeE7fJShhfc2TTrgBjJ Y2Fl4Ez1xhmLwnNYITdw5EqG5YmZPNpdlnsWVSInE773IK+SH/bYL621FDaz/uzR9zpb95TTCZc UxlgDsDOHgOvcKf4PtHmWeyw= X-Received: by 127.0.0.2 with SMTP id PapRYY7687511x4jo9mhwB8l; Sun, 11 Feb 2024 15:10:43 -0800 X-Received: from wfhigh1-smtp.messagingengine.com (wfhigh1-smtp.messagingengine.com [64.147.123.152]) by mx.groups.io with SMTP id smtpd.web10.48601.1707693042947781043 for ; Sun, 11 Feb 2024 15:10:43 -0800 X-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id EDD65180007B; Sun, 11 Feb 2024 18:10:41 -0500 (EST) X-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 11 Feb 2024 18:10:42 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddvgddtjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeftvggsvggt tggrucevrhgrnhcuoehrvggsvggttggrsegsshguihhordgtohhmqeenucggtffrrghtth gvrhhnpeejhefgtdeludeitefffeevteduhfeiffdtieeuleelgfevuddthffhudegfeel heenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrvg gsvggttggrsegsshguihhordgtohhm X-ME-Proxy: Feedback-ID: i5b994698:Fastmail X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 11 Feb 2024 18:10:40 -0500 (EST) Message-ID: Date: Sun, 11 Feb 2024 16:10:32 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH 1/1] EmbeddedPkg/Scripts/LauterbachT32: Fix EfiLoadDxe.cmm To: devel@edk2.groups.io, rebecca@os.amperecomputing.com, Leif Lindholm , Ard Biesheuvel , Abner Chang , Michael D Kinney References: <20240129190136.1377641-1-rebecca@os.amperecomputing.com> <20240129190136.1377641-2-rebecca@os.amperecomputing.com> From: "Rebecca Cran" In-Reply-To: <20240129190136.1377641-2-rebecca@os.amperecomputing.com> Precedence: Bulk 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,rebecca@bsdio.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: kJcRlYX9YVPLGME0lgtJTW5Nx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=aDQA+FCd; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io I'm guessing there haven't been any reviews because so few people are=20 familiar with the PRACTICE scripting language. If there's nobody who can review it, could I get approval to commit it=20 anyway? --=20 Rebecca Cran On 1/29/24 12:01, Rebecca Cran via groups.io wrote: > There have been many changes since EfiLoadDxe.cmm was last updated in > 2011. The EFI_SYSTEM_TABLE can no longer be found by scanning memory on > 4KB boundaries, so require users pass in its address instead. Update > various offsets so that the debug information can be found and loaded > with a recent version of TRACE32. > > Signed-off-by: Rebecca Cran > --- > EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm | 77 +++-------= ---------- > EmbeddedPkg/Scripts/LauterbachT32/EfiProcessPeImage.cmm | 7 +- > EmbeddedPkg/Scripts/LauterbachT32/Readme.md | 8 +- > 3 files changed, 19 insertions(+), 73 deletions(-) > > diff --git a/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm b/EmbeddedP= kg/Scripts/LauterbachT32/EfiLoadDxe.cmm > index 1605a9b478df..06d307e12d8c 100644 > --- a/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm > +++ b/EmbeddedPkg/Scripts/LauterbachT32/EfiLoadDxe.cmm > @@ -1,79 +1,22 @@ > ; > +; Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
> ; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.
> ; > ; SPDX-License-Identifier: BSD-2-Clause-Patent > ; > =20 > - LOCAL &maxmem &systbl &memsize > - > - &memsize=3D0x20000000 ; default to 512MB > - > - gosub FindSystemTable &memsize > - ENTRY &systbl > - > - if &systbl!=3D0 > - ( > - print "found system table at &systbl" > - gosub FindDebugInfo &systbl > - ) > - else > - ( > - print "ERROR: system table not found, check memory size" > - ) > + PARAMETERS &systbl > + > + gosub FindDebugInfo &systbl > enddo > =20 > -FindSystemTable: > - LOCAL &TopOfRam &offset > - ENTRY &TopOfRam > - > - print "FindSystemTable" > - print "top of mem is &TopOfRam$" > - > - &offset=3D&TopOfRam > - > - ; align to highest 4MB boundary > - &offset=3D&offset&0xFFC00000 > - > - ; start at top and look on 4MB boundaries for system table ptr structu= re > - while &offset>0 > - ( > - ; low signature match > - if Data.Long(a:&offset)=3D=3D0x20494249 > - ( > - ; high signature match > - if Data.Long(a:&offset+4)=3D=3D0x54535953 > - ( > - ; less than 4GB? > - if Data.Long(a:&offset+0x0c)=3D=3D0 > - ( > - ; less than top of ram? > - if Data.Long(a:&offset+8)<&TopOfRam > - ( > - return Data.Long(a:&offset+8) > - ) > - ) > - ) > - ) > - > - if &offset<0x400000 > - ( > - return 0 > - ) > - &offset=3D&offset-0x400000 > - ) > - > - return 0 > - > - > FindDebugInfo: > LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr= &dbgentries &dbgptr &dbginfo &loadedimg > ENTRY &SystemTable > =20 > - print "FindDebugInfo" > - > &dbgentries=3D0 > - &CfgTableEntries=3DData.Long(a:&SystemTable+0x40) > - &ConfigTable=3DData.Long(a:&SystemTable+0x44) > + &CfgTableEntries=3DData.Long(a:&SystemTable+0x68) > + &ConfigTable=3DData.Long(a:&SystemTable+0x70) > =20 > print "config table is at &ConfigTable (&CfgTableEntries entries)" > =20 > @@ -82,7 +25,7 @@ FindDebugInfo: > &i=3D0 > while &i<&CfgTableEntries > ( > - &offset=3D&ConfigTable+(&i*0x14) > + &offset=3D&ConfigTable+(&i*0x18) > if Data.Long(a:&offset)=3D=3D0x49152E77 > ( > if Data.Long(a:&offset+4)=3D=3D0x47641ADA > @@ -120,8 +63,10 @@ FindDebugInfo: > ( > if Data.Long(a:&dbginfo)=3D=3D1 ; normal debug info type > ( > - &loadedimg=3DData.Long(a:&dbginfo+4) > - do EfiProcessPeImage Data.Long(a:&loadedimg+0x20) > + &loadedimg=3DData.Long(a:&dbginfo+8) > + &imagebaseptr=3D&loadedimg+0x40 > + &imagebase=3DData.Long(a:&imagebaseptr) > + do ~~~~/EfiProcessPeImage.cmm "&imagebase" > ) > ) > &i=3D&i+1 > diff --git a/EmbeddedPkg/Scripts/LauterbachT32/EfiProcessPeImage.cmm b/Em= beddedPkg/Scripts/LauterbachT32/EfiProcessPeImage.cmm > index c3aab9d06a47..b0d97eec71b0 100644 > --- a/EmbeddedPkg/Scripts/LauterbachT32/EfiProcessPeImage.cmm > +++ b/EmbeddedPkg/Scripts/LauterbachT32/EfiProcessPeImage.cmm > @@ -1,4 +1,5 @@ > ; > +; Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
> ; Copyright (c) 2011, Hewlett-Packard Company. All rights reserved.
> ; > ; SPDX-License-Identifier: BSD-2-Clause-Patent > @@ -10,11 +11,11 @@ > &imgstart=3D&imgstart > print "PE32 image found at &imgstart" > =20 > - ; offset from dos hdr to PE file hdr > + ; offset from dos hdr to PE file hdr (i.e. 'PE\0\0' signature) > &filehdrstart=3D&imgstart+Data.Long(c:&imgstart+0x3C) > =20 > ; offset to debug dir in PE hdrs > - &debugdirentryrva=3DData.Long(c:&filehdrstart+0xA8) > + &debugdirentryrva=3DData.Long(c:&imgstart+0xf10) > if &debugdirentryrva=3D=3D0 > ( > print "no debug dir for image at &imgstart" > @@ -62,7 +63,7 @@ > &elfbase=3D&baseofdata; > ) > =20 > - print "found path &elfpath" > + print "found path &elfpath with address &elfbase" > ON ERROR GOSUB > return > data.load.elf &elfpath &elfbase /NOCODE /NOCLEAR > diff --git a/EmbeddedPkg/Scripts/LauterbachT32/Readme.md b/EmbeddedPkg/Sc= ripts/LauterbachT32/Readme.md > index 51d2c8da5405..c30ec20a3d96 100644 > --- a/EmbeddedPkg/Scripts/LauterbachT32/Readme.md > +++ b/EmbeddedPkg/Scripts/LauterbachT32/Readme.md > @@ -1,10 +1,10 @@ > # DXE Phase Debug > -Update the memsize variable in EfiLoadDxe.cmm for the actual amount of m= emory > -available in your system. Allow your system to boot to the point that t= he DXE > +Allow your system to boot to the point that the DXE > core is initialized (so that the System Table and Debug Information tab= le is > present in memory) and execute this script (using the toolbar button or > -'do EfiLoadDxe' from the command area). It will scan memory for the deb= ug info > -table and load modules in it. > +'do EfiLoadDxe "0xGST_ADDRESS"' from the command area). 'GST_ADDRESS' is= the > +address of the EFI_SYSTEM_TABLE, and can be found by the global `gST`. > +The script will scan memory for the debug info table and load modules in= it. > =20 > # SEC/PEI Phase Debug > There is no way to autodetect where these images reside so you must pas= s an -=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 (#115345): https://edk2.groups.io/g/devel/message/115345 Mute This Topic: https://groups.io/mt/104038273/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-