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 F349E74003D for ; Mon, 29 Jan 2024 19:01:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=UGdqxJS8fAlsldRoJqM13oRUUFeJe+XsNApb5CZ/p8o=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1706554918; v=1; b=pxREhRLIVuKa9DfteCj4Sw7TNdu7P7FzUscqcwaDWqe+0CYIdDAYoCdzngfuoi4Yb77t0AYV SD92A76dboDtN5V9gMxCpz2EvTYTPMZUprHgxDAx6sfRObmuCmxMAFhvsp86RDckR72mk9D+edn hSxPAFSejVOz8OU0aqJ29BtQ= X-Received: by 127.0.0.2 with SMTP id IwQCYY7687511xWsOpfjme65; Mon, 29 Jan 2024 11:01:58 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.99]) by mx.groups.io with SMTP id smtpd.web11.3804.1706554917432770658 for ; Mon, 29 Jan 2024 11:01:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FvHW9BBSsmptLvdbQjMXLdZ6NkxlT9iUTBZ7m9tDK5rs2J9moIiMrOHK1lWP72Up9AzH03FGs0r5qaeQTYOxT6VF08NLPNr5tbYolPgv4ZwkIa//JR8TpzRC4GilCU96H1FGlYZr39YcGca5s0dBIaau3jThjbWOduWgI2fiEtQOwHwBn2Fvb0TwJvY+mkt18x6TKtZNb3TKXhBqsgcLTewZkseFXs2rVxjL72KU3Hwf4AkVEYjRnQ6HK0Vfy0WmqykUC2pYoWLyxyX3eWC2OSoVIwxYLPsG2Taf7KoT2XLnYO8ERT0I+m84nbGyYmXlsMrVzfVfSgmWDOee6xt79g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T/Sr+X1xpU0j0LjKmcOpX0yF+NfSPaBMf0wikmxchYs=; b=HcIQmMu0nWK+6vShqo0DVPNjsmQ1pqUa7+WwLoTX6RPnxhXpMiKsxHc/XNyQYIvdfkeHwRQXyViUZpVs7i8FWes3IJRwtBVHLHQ/KBkRGoaN6APAsf1WzoW5sGUGfeHhfexCyGyv4gZzqAznEAI99CB7zXBAmtu2nNtJdeSqNbYHI9sG60f5FDsp9NmE3rNrjVSgZHc8RxCqER4x/Z0LHSn3f/Kfe4grRtLtTfZAhibAsmiEoVXZsgdsE6l1igby+faLc87o2Fd+6eP7Z61yePY/92wks4Ah05p3fHaalmCqbunpLr57gW4zaO4Xu0rCfr+nBWblNlkOw+mrJ9tyow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none X-Received: from LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) by CO1PR01MB6584.prod.exchangelabs.com (2603:10b6:303:f1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.34; Mon, 29 Jan 2024 19:01:53 +0000 X-Received: from LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1]) by LV3PR01MB8464.prod.exchangelabs.com ([fe80::7748:d4a3:bcd9:14c1%6]) with mapi id 15.20.7228.029; Mon, 29 Jan 2024 19:01:53 +0000 From: "Rebecca Cran via groups.io" To: Leif Lindholm , Ard Biesheuvel , Abner Chang , devel@edk2.groups.io CC: Rebecca Cran Subject: [edk2-devel] [PATCH 1/1] EmbeddedPkg/Scripts/LauterbachT32: Fix EfiLoadDxe.cmm Date: Mon, 29 Jan 2024 12:01:36 -0700 Message-ID: <20240129190136.1377641-2-rebecca@os.amperecomputing.com> In-Reply-To: <20240129190136.1377641-1-rebecca@os.amperecomputing.com> References: <20240129190136.1377641-1-rebecca@os.amperecomputing.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) To LV3PR01MB8464.prod.exchangelabs.com (2603:10b6:408:1a3::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV3PR01MB8464:EE_|CO1PR01MB6584:EE_ X-MS-Office365-Filtering-Correlation-Id: 9629eee2-8b30-444c-1f3d-08dc20fcc086 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: guo/B2fbiaootrhWXOZtZtYSkojtjOx2eisH2/077BG4ZYwxTCHev7blw9Eqfno8GYIpEeM0o4HnUbnVm3Qwa7pfI8KU1bCcgiRxhEmDMcUy/UVTP1MRzTopaozge3RMW4s84NbbiUgrIx91xbduxmv/bCqfxl0pbOjhO+CojUHFX4ArzKG48TdiX0NalQyyHNRcGEkZCpYotYLzDql+DvblRU22m2hfKb9p0gE0LzYZIRwd/MAx8rzM/5ZFdJ2HGXVPtUVCZoZLnm5zZIZSOtjO4o9PRkW3Lz2BEecGyVFGyEmcYL3C+wtZ992EWTmasKPRyeydqI/VUMAr8zVz7MNcpHWwWMrr6ZepDYNOMnhb6L8b8QlJotBhpj99uKWFTwivG/uaZDjP9DksaEH9FlzW3QeFTaANk8qsguarAzV3KoEyRAvuWrbJ54nvJiD1oM+OSOcnpHzVa23ZtOg8FfiN9QjRb1wIzFtza5sNG4c1WoWUrHFfEUWGd0ras5feTLGvGKUu77TsHBEtltqmDd/mHRzQ0QfTrDmrGu1XhZP3BjTIx/a00ZF2ZChxdi5tQg7hf4F/uEn76JjTXIv6r+/mkrxuWgpZe5hF3SqS6InVOXmcTpbyLtyavZPb9Z4H X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GH3ikR9o3dvEc9UfzpqnadqeGcT7p/eAg2bRRAus7xPr5BBuCl51DmEU8wYa?= =?us-ascii?Q?+m4v2neBBjG3D2RyxrOJrmsDQsVh+jpVA+SkKVxD6t5zsMR36RfQo1XAZ/9A?= =?us-ascii?Q?TQl8tt/DnQaZbBdHSGLkqYq1726Q+q+CLocf7whhXbbjj+5fft9BOE2+ykjj?= =?us-ascii?Q?gPPbx8L5CONNKA6qXnF/O9rEQe9rDIchOfiHX26NeHJTYmwrS3g6z1f5LALc?= =?us-ascii?Q?L/EnUbPhlBzHvHiq3KWqzV4TSbg3mKxVloIfcOSyysF9Q4SZWtItj/gm5iD3?= =?us-ascii?Q?jDBmCtYouN8pVwCWntJyrwurdkdQ92jmeVHe6cp4tAMDD5ZD/OliUryL7ADj?= =?us-ascii?Q?KO7t6D2oKftzZuJVFubZvx9stjN3XnJkCJJx465uljJVPbsHrTJvGoFT0yTT?= =?us-ascii?Q?QjUoDUfFU1SqSYyqgfgQbeUlqWehD02pULoXvoloCyjsCo0C301xGS4Ml0iu?= =?us-ascii?Q?W8mm3flH+sjxAr+wurPWVT5iWDsnWPipZ6UIsZ/7xS440rrxlVrwfbGo2eoU?= =?us-ascii?Q?zHmcrWLvWQXhja79C4+0ozBP51dHzy0TR6KscRgI10wqP8vOdx2J6bZ9Ln6u?= =?us-ascii?Q?ZEJZ2uaMeDHslCUxchHk5T7z0Kmx1P0rnTmhHUcpRGrsNKwPzIJIDdBNk4Yt?= =?us-ascii?Q?o9ohEoiwjBSJDv2DpApgqOqnfiKdqI5skQSax62UNY/0TPJDM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3EMxMHlXfvVw32rcKIiLkkB09pyEP0L5+xzg8Jv/A5K9QrV?= =?us-ascii?Q?UZ0XQY72mKrsMGruHUKxnYY=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9629eee2-8b30-444c-1f3d-08dc20fcc086 X-MS-Exchange-CrossTenant-AuthSource: LV3PR01MB8464.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2024 19:01:51.4554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ejuU7Z4F+mS+0M6ezRyJIlxiDM8zOhJbMO3Zzwp0m+rO7yIkVnA8Vf/6wZ+D/eM/UFRY5EvSr5gDknT5n0ObPX7xRJw03L9sjCQZ4mmXbx6Vr8wHTtYSwoSc+69sUxSg X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6584 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@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: naQCfBnJVgeJSO1FxW0DKnnjx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=pxREhRLI; 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; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") 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/EmbeddedPkg= /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.
;=20 ; SPDX-License-Identifier: BSD-2-Clause-Patent ;=20 =20 - LOCAL &maxmem &systbl &memsize - =20 - &memsize=3D0x20000000 ; default to 512MB - =20 - gosub FindSystemTable &memsize - ENTRY &systbl - =20 - 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 - =20 - print "FindSystemTable" - print "top of mem is &TopOfRam$" - =20 - &offset=3D&TopOfRam - =20 - ; align to highest 4MB boundary - &offset=3D&offset&0xFFC00000 - =20 - ; start at top and look on 4MB boundaries for system table ptr structure - 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) - ) - ) - ) - ) - =20 - if &offset<0x400000 - ( - return 0 - ) - &offset=3D&offset-0x400000 - ) - =20 - return 0 - - FindDebugInfo: LOCAL &SystemTable &CfgTableEntries &ConfigTable &i &offset &dbghdr &d= bgentries &dbgptr &dbginfo &loadedimg ENTRY &SystemTable =20 - print "FindDebugInfo" - =20 &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/Embe= ddedPkg/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.
;=20 ; 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/Scri= pts/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 mem= ory -available in your system. Allow your system to boot to the point that the= DXE +Allow your system to boot to the point that the DXE core is initialized (so that the System Table and Debug Information table = 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 debug= info -table and load modules in it. +'do EfiLoadDxe "0xGST_ADDRESS"' from the command area). 'GST_ADDRESS' is t= he +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 i= t. =20 # SEC/PEI Phase Debug There is no way to autodetect where these images reside so you must pass a= n --=20 2.34.1 -=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 (#114736): https://edk2.groups.io/g/devel/message/114736 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-