From nobody Sun May 5 15:24:16 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+79669+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+79669+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=posteo.de ARC-Seal: i=1; a=rsa-sha256; t=1629575786; cv=none; d=zohomail.com; s=zohoarc; b=Pxvw/N8ZwPisUkhpo1fFB6Hu5GZs0mbLnpnS+S03W6pKbsz9IDXFW9f5ryi5kONiG6tkqFNIYfSonfzgAnegMREfzMIPL1knUx0vyXW9gCnpzu/zkOK+SnsU6Rv+hYPq6lG2L8hARYi/E3+5Lomf9aAY/9VTPiWpyxNDTUASDlk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629575786; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9wBL5kFWgOOCHBg5ly/q/ENercJJR6OQHpIFYYsIZoM=; b=AQAqFY1Wt+K0I4n0ugG+wurJkRipBdGl4mmlfXmmNFEaHbAo1HJQ3/REMGYS8g/qquUixNmZFbGQCfmIdFOqWd/OThgkKPebLUtc4jdRrEaxA9cr3gpJ0KvpF7GMzCCbTFQHkdmufk6S0CAGTq9DhPFZedjAKHl7xT9IMVQ/Plc= 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+79669+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 1629575786393707.1662602949273; Sat, 21 Aug 2021 12:56:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Jjz4YY1788612xAweKQHK7Vf; Sat, 21 Aug 2021 12:56:26 -0700 X-Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.2461.1629575784124446127 for ; Sat, 21 Aug 2021 12:56:24 -0700 X-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 6838B240028 for ; Sat, 21 Aug 2021 21:56:22 +0200 (CEST) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GsTlp0TGTz9rxP; Sat, 21 Aug 2021 21:56:22 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni , Vitaly Cheptsov Subject: [edk2-devel] [PATCH 1/3] EmulatorPkg: Use Image base address for GDB symbols loading Date: Sat, 21 Aug 2021 19:55:45 +0000 Message-Id: <750e31c0e12705c54e9367ad1315f611cd198930.1629574351.git.mhaeuser@posteo.de> In-Reply-To: References: 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,mhaeuser@posteo.de X-Gm-Message-State: 74pXlY4eudEu8egWOsKZQaTFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629575786; bh=0XQvvr7CNaENgCJKTJh9vBDpL+1Gduqr7xLz8hZmchU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=N3wNS1CKN+Xz2Zr+s7+FT0dQioXxV9TjXAKNbl1ZoothK1Mwhty3zAoXhbj07WySjJo +CZkGfQO+RyWMA9RiZTZ2FEWOHbPAOAjFWmdYPHNR+HVajQf97LHLhnCuhxy4GS7R7D/u nUij8DDoaZYNtg0Chf1T4F5hc2Q3BSsdYr0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629576689789100001 Content-Type: text/plain; charset="utf-8" GDB symbols are currently loaded by specifying the .text section address. It is assumed to be the value of the PE/COFF SizeOfHeaders field. This may not be the case for various reasons, including a sufficiently strict Image section alignment. Use the "-o" parameter to specify the Image base address instead. This works because the GCC linker scripts are designed to emit Image section addresses that are equal to those of the final PE/COFF Image. Cc: Andrew Fish Cc: Ray Ni Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- EmulatorPkg/Unix/Host/Host.c | 12 ++++++------ EmulatorPkg/Unix/GdbRun.sh | 2 +- EmulatorPkg/Unix/lldbefi.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c index b4e5510613c8..f5b7d6709e47 100644 --- a/EmulatorPkg/Unix/Host/Host.c +++ b/EmulatorPkg/Unix/Host/Host.c @@ -1042,7 +1042,7 @@ PrintLoadAddress ( } else { fprintf (stderr, "0x%08lx Loading %s with entry point 0x%08lx\n", - (unsigned long)(ImageContext->ImageAddress + ImageContext->SizeOfHea= ders), + (unsigned long)ImageContext->ImageAddress, ImageContext->PdbPointer, (unsigned long)ImageContext->EntryPoint ); @@ -1148,7 +1148,7 @@ GdbScriptAddImage ( if (FeaturePcdGet (PcdEmulatorLazyLoadSymbols)) { GdbTempFile =3D fopen (gGdbWorkingFileName, "a"); if (GdbTempFile !=3D NULL) { - long unsigned int SymbolsAddr =3D (long unsigned int)(ImageContext= ->ImageAddress + ImageContext->SizeOfHeaders); + long unsigned int SymbolsAddr =3D (long unsigned int)ImageContext-= >ImageAddress; mScriptSymbolChangesCount++; fprintf ( GdbTempFile, @@ -1159,7 +1159,7 @@ GdbScriptAddImage ( ); fclose (GdbTempFile); // This is for the lldb breakpoint only - SecGdbScriptBreak (ImageContext->PdbPointer, strlen (ImageContext-= >PdbPointer) + 1, (long unsigned int)(ImageContext->ImageAddress + ImageCon= text->SizeOfHeaders), 1); + SecGdbScriptBreak (ImageContext->PdbPointer, strlen (ImageContext-= >PdbPointer) + 1, (long unsigned int)ImageContext->ImageAddress, 1); } else { ASSERT (FALSE); } @@ -1168,9 +1168,9 @@ GdbScriptAddImage ( if (GdbTempFile !=3D NULL) { fprintf ( GdbTempFile, - "add-symbol-file %s 0x%08lx\n", + "add-symbol-file %s -o 0x%08lx\n", ImageContext->PdbPointer, - (long unsigned int)(ImageContext->ImageAddress + ImageContext->S= izeOfHeaders) + (long unsigned int)ImageContext->ImageAddress ); fclose (GdbTempFile); =20 @@ -1180,7 +1180,7 @@ GdbScriptAddImage ( // Also used for the lldb breakpoint script. The lldb breakpoint s= cript does // not use the file, it uses the arguments. // - SecGdbScriptBreak (ImageContext->PdbPointer, strlen (ImageContext-= >PdbPointer) + 1, (long unsigned int)(ImageContext->ImageAddress + ImageCon= text->SizeOfHeaders), 1); + SecGdbScriptBreak (ImageContext->PdbPointer, strlen (ImageContext-= >PdbPointer) + 1, (long unsigned int)ImageContext->ImageAddress, 1); } else { ASSERT (FALSE); } diff --git a/EmulatorPkg/Unix/GdbRun.sh b/EmulatorPkg/Unix/GdbRun.sh index b050ad5e2c5c..6fea1c9d5b82 100644 --- a/EmulatorPkg/Unix/GdbRun.sh +++ b/EmulatorPkg/Unix/GdbRun.sh @@ -41,7 +41,7 @@ set $SymbolFileChangesCount =3D 0 # define AddFirmwareSymbolFile if $SymbolFileChangesCount < $arg0 - add-symbol-file $arg1 $arg2 + add-symbol-file $arg1 -o $arg2 set $SymbolFileChangesCount =3D $arg0 end end diff --git a/EmulatorPkg/Unix/lldbefi.py b/EmulatorPkg/Unix/lldbefi.py index c3fb2675cbc1..4f4c04509e58 100755 --- a/EmulatorPkg/Unix/lldbefi.py +++ b/EmulatorPkg/Unix/lldbefi.py @@ -395,7 +395,7 @@ def LoadEmulatorEfiSymbols(frame, bp_loc , internal_dic= t): =20 debugger =3D frame.thread.process.target.debugger if frame.FindVariable ("AddSymbolFlag").GetValueAsUnsigned() =3D=3D 1: - LoadAddress =3D frame.FindVariable ("LoadAddress").GetValueAsUnsig= ned() - 0x240 + LoadAddress =3D frame.FindVariable ("LoadAddress").GetValueAsUnsig= ned() =20 debugger.HandleCommand ("target modules add %s" % FileName) print "target modules load --slid 0x%x %s" % (LoadAddress, FileNam= e) --=20 2.31.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 (#79669): https://edk2.groups.io/g/devel/message/79669 Mute This Topic: https://groups.io/mt/85048606/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- From nobody Sun May 5 15:24:16 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+79671+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+79671+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=posteo.de ARC-Seal: i=1; a=rsa-sha256; t=1629575787; cv=none; d=zohomail.com; s=zohoarc; b=DtUgIXEKuTE84+6xuTHg2+N553KSuFkpztYTPPsvJ6Tb+3pj0CWt36xN+IlQM2yQkda4SlbtIzZ6+6XamrwEAtgOexI6HF+YFXOME6/XJt1+mzrHJtAg7WUg/7cRmXx6kCcxAijgNI2J5HjoxpaGiTn2RTqVwYEVprlObGFHZ7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629575787; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=EsuGcLLscAmr6qFzjLNT7vhGhsHRWp1n3y0bD2oUs2k=; b=bOKJdTgPmohOntbSrAlox6MUwM+UzTw3bRfZDHctnQ5tEF3zjoieLEYr6ybpSPkETLsqguuvy3/F+CKEEQriRwgUHxBSg5DeXS6c7HLBTV/bnK8UsX222qHirAtiSy9/CcwrLEMCRnXb7CwJZGw+nK5YUoh0a6kBDozZZpqJuXA= 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+79671+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 1629575787219629.2070176139723; Sat, 21 Aug 2021 12:56:27 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gBJiYY1788612xdNGf9i2Gws; Sat, 21 Aug 2021 12:56:26 -0700 X-Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.2463.1629575784425973302 for ; Sat, 21 Aug 2021 12:56:25 -0700 X-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id D5EC0240028 for ; Sat, 21 Aug 2021 21:56:22 +0200 (CEST) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GsTlp28Ypz9rxM; Sat, 21 Aug 2021 21:56:22 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Eric Dong , Ray Ni , Vitaly Cheptsov Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg: Move PiSmmCoreMemoryAllocationLib into PiSmmCore Date: Sat, 21 Aug 2021 19:55:46 +0000 Message-Id: In-Reply-To: References: 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,mhaeuser@posteo.de X-Gm-Message-State: btCCz334TKMtgGu5FBdGbNgXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629575786; bh=eRXSl3w776jhklpzcA46Ol0U3+VbkWToDSdqaUoypco=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=YV3Ek9fDXrR+NpQ+GVicQXxwRE6IHeqmEJNZjpCGDGR7BYSiHgllRPXNlRKKzV+xXEn pCJt4J5eY8tANMTOMgVNNH0RrRC2Eb34pC3wZaS1jlbvu6VpaswhQqQ2bdwjhL6aF3BKY AnlP7GKxSWYm9IUtFPeldrfoANb+vgvabIM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629576689828100002 Content-Type: text/plain; charset="utf-8" PiSmmCoreMemoryAllocationLib duplicates private definitions of PiSmmCore, namely the SMM_CORE_PRIVATE_DATA structure. Move this code into PiSmmCore, so that the struct definition can be consumed directly instead. Cc: Jian J Wang Cc: Hao A Wu Cc: Eric Dong Cc: Ray Ni Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- MdeModulePkg/{Library/PiSmmCoreMemoryAllocationLib/MemoryAllocationLib.c = =3D> Core/PiSmmCore/MemoryAllocation.c} | 3 +- MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf = | 1 + MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocatio= nLib.inf | 5 +- MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocatio= nProfileLib.inf | 6 +- MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocatio= nServices.h | 185 -------------------- 5 files changed, 10 insertions(+), 190 deletions(-) diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/MemoryAlloca= tionLib.c b/MdeModulePkg/Core/PiSmmCore/MemoryAllocation.c similarity index 96% rename from MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/MemoryAllocat= ionLib.c rename to MdeModulePkg/Core/PiSmmCore/MemoryAllocation.c index fd20a779cdcc..fb99174c9d8d 100644 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/MemoryAllocationLib= .c +++ b/MdeModulePkg/Core/PiSmmCore/MemoryAllocation.c @@ -22,7 +22,8 @@ #include #include #include -#include "PiSmmCoreMemoryAllocationServices.h" +#include "PiSmmCore.h" +#include "PiSmmCorePrivateData.h" =20 #include =20 diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf b/MdeModulePkg/Core/= PiSmmCore/PiSmmCore.inf index c8bfae3860fc..85628f927134 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf @@ -37,6 +37,7 @@ [Sources] SmiHandlerProfile.c HeapGuard.c HeapGuard.h + MemoryAllocation.c =20 [Packages] MdePkg/MdePkg.dec diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMem= oryAllocationLib.inf b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/Pi= SmmCoreMemoryAllocationLib.inf index 5c51c48b0b1e..8812c9604103 100644 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationLib.inf +++ b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationLib.inf @@ -19,6 +19,9 @@ [Defines] VERSION_STRING =3D 1.0 PI_SPECIFICATION_VERSION =3D 0x0001000A LIBRARY_CLASS =3D MemoryAllocationLib|SMM_CORE + # + # This function is defined in PiSmmCore. + # CONSTRUCTOR =3D PiSmmCoreMemoryAllocationLibConstruct= or =20 # @@ -28,8 +31,6 @@ [Defines] # =20 [Sources] - MemoryAllocationLib.c - PiSmmCoreMemoryAllocationServices.h PiSmmCoreMemoryProfileLibNull.c =20 [Packages] diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMem= oryAllocationProfileLib.inf b/MdeModulePkg/Library/PiSmmCoreMemoryAllocatio= nLib/PiSmmCoreMemoryAllocationProfileLib.inf index 89658c0f6ccb..c3b8a4fdce7b 100644 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationProfileLib.inf +++ b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationProfileLib.inf @@ -19,6 +19,9 @@ [Defines] VERSION_STRING =3D 1.0 PI_SPECIFICATION_VERSION =3D 0x0001000A LIBRARY_CLASS =3D MemoryAllocationLib|SMM_CORE + # + # This function is defined in PiSmmCore. + # CONSTRUCTOR =3D PiSmmCoreMemoryAllocationLibConstruct= or LIBRARY_CLASS =3D MemoryProfileLib|SMM_CORE CONSTRUCTOR =3D PiSmmCoreMemoryProfileLibConstructor @@ -30,8 +33,6 @@ [Defines] # =20 [Sources] - MemoryAllocationLib.c - PiSmmCoreMemoryAllocationServices.h PiSmmCoreMemoryProfileLib.c PiSmmCoreMemoryProfileServices.h =20 @@ -43,6 +44,7 @@ [LibraryClasses] DebugLib BaseMemoryLib UefiBootServicesTableLib + MemoryAllocationLib =20 [Guids] gEdkiiMemoryProfileGuid ## SOMETIMES_CONSUMES ## GUID # Locate proto= col diff --git a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMem= oryAllocationServices.h b/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib= /PiSmmCoreMemoryAllocationServices.h deleted file mode 100644 index 789fcf2c01ea..000000000000 --- a/MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllo= cationServices.h +++ /dev/null @@ -1,185 +0,0 @@ -/** @file - Contains function prototypes for Memory Services in the SMM Core. - - This header file borrows the PiSmmCore Memory Allocation services as the= primitive - for memory allocation. - - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_ -#define _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_ - -// -// It should be aligned with the definition in PiSmmCore. -// -typedef struct { - UINTN Signature; - - /// - /// The ImageHandle passed into the entry point of the SMM IPL. This Im= ageHandle - /// is used by the SMM Core to fill in the ParentImageHandle field of th= e Loaded - /// Image Protocol for each SMM Driver that is dispatched by the SMM Cor= e. - /// - EFI_HANDLE SmmIplImageHandle; - - /// - /// The number of SMRAM ranges passed from the SMM IPL to the SMM Core. = The SMM - /// Core uses these ranges of SMRAM to initialize the SMM Core memory ma= nager. - /// - UINTN SmramRangeCount; - - /// - /// A table of SMRAM ranges passed from the SMM IPL to the SMM Core. Th= e SMM - /// Core uses these ranges of SMRAM to initialize the SMM Core memory ma= nager. - /// - EFI_SMRAM_DESCRIPTOR *SmramRanges; - - /// - /// The SMM Foundation Entry Point. The SMM Core fills in this field wh= en the - /// SMM Core is initialized. The SMM IPL is responsbile for registering= this entry - /// point with the SMM Configuration Protocol. The SMM Configuration Pr= otocol may - /// not be available at the time the SMM IPL and SMM Core are started, s= o the SMM IPL - /// sets up a protocol notification on the SMM Configuration Protocol an= d registers - /// the SMM Foundation Entry Point as soon as the SMM Configuration Prot= ocol is - /// available. - /// - EFI_SMM_ENTRY_POINT SmmEntryPoint; - - /// - /// Boolean flag set to TRUE while an SMI is being processed by the SMM = Core. - /// - BOOLEAN SmmEntryPointRegistered; - - /// - /// Boolean flag set to TRUE while an SMI is being processed by the SMM = Core. - /// - BOOLEAN InSmm; - - /// - /// This field is set by the SMM Core then the SMM Core is initialized. = This field is - /// used by the SMM Base 2 Protocol and SMM Communication Protocol imple= mentations in - /// the SMM IPL. - /// - EFI_SMM_SYSTEM_TABLE2 *Smst; - - /// - /// This field is used by the SMM Communicatioon Protocol to pass a buff= er into - /// a software SMI handler and for the software SMI handler to pass a bu= ffer back to - /// the caller of the SMM Communication Protocol. - /// - VOID *CommunicationBuffer; - - /// - /// This field is used by the SMM Communicatioon Protocol to pass the si= ze of a buffer, - /// in bytes, into a software SMI handler and for the software SMI handl= er to pass the - /// size, in bytes, of a buffer back to the caller of the SMM Communicat= ion Protocol. - /// - UINTN BufferSize; - - /// - /// This field is used by the SMM Communication Protocol to pass the ret= urn status from - /// a software SMI handler back to the caller of the SMM Communication P= rotocol. - /// - EFI_STATUS ReturnStatus; - - EFI_PHYSICAL_ADDRESS PiSmmCoreImageBase; - UINT64 PiSmmCoreImageSize; - EFI_PHYSICAL_ADDRESS PiSmmCoreEntryPoint; -} SMM_CORE_PRIVATE_DATA; - -/** - Called to initialize the memory service. - - @param SmramRangeCount Number of SMRAM Regions - @param SmramRanges Pointer to SMRAM Descriptors - -**/ -VOID -SmmInitializeMemoryServices ( - IN UINTN SmramRangeCount, - IN EFI_SMRAM_DESCRIPTOR *SmramRanges - ); - -/** - Allocates pages from the memory map. - - @param Type The type of allocation to perform - @param MemoryType The type of memory to turn the allocated = pages - into - @param NumberOfPages The number of pages to allocate - @param Memory A pointer to receive the base allocated m= emory - address - - @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined= in spec. - @retval EFI_NOT_FOUND Could not allocate pages match the requir= ement. - @retval EFI_OUT_OF_RESOURCES No enough pages to allocate. - @retval EFI_SUCCESS Pages successfully allocated. - -**/ -EFI_STATUS -EFIAPI -SmmAllocatePages ( - IN EFI_ALLOCATE_TYPE Type, - IN EFI_MEMORY_TYPE MemoryType, - IN UINTN NumberOfPages, - OUT EFI_PHYSICAL_ADDRESS *Memory - ); - -/** - Frees previous allocated pages. - - @param Memory Base address of memory being freed - @param NumberOfPages The number of pages to free - - @retval EFI_NOT_FOUND Could not find the entry that covers the = range - @retval EFI_INVALID_PARAMETER Address not aligned - @return EFI_SUCCESS Pages successfully freed. - -**/ -EFI_STATUS -EFIAPI -SmmFreePages ( - IN EFI_PHYSICAL_ADDRESS Memory, - IN UINTN NumberOfPages - ); - -/** - Allocate pool of a particular type. - - @param PoolType Type of pool to allocate - @param Size The amount of pool to allocate - @param Buffer The address to return a pointer to the al= located - pool - - @retval EFI_INVALID_PARAMETER PoolType not valid - @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation = failed. - @retval EFI_SUCCESS Pool successfully allocated. - -**/ -EFI_STATUS -EFIAPI -SmmAllocatePool ( - IN EFI_MEMORY_TYPE PoolType, - IN UINTN Size, - OUT VOID **Buffer - ); - -/** - Frees pool. - - @param Buffer The allocated pool entry to free - - @retval EFI_INVALID_PARAMETER Buffer is not a valid value. - @retval EFI_SUCCESS Pool successfully freed. - -**/ -EFI_STATUS -EFIAPI -SmmFreePool ( - IN VOID *Buffer - ); - -#endif --=20 2.31.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 (#79671): https://edk2.groups.io/g/devel/message/79671 Mute This Topic: https://groups.io/mt/85048608/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- From nobody Sun May 5 15:24:16 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+79672+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+79672+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=posteo.de ARC-Seal: i=1; a=rsa-sha256; t=1629575787; cv=none; d=zohomail.com; s=zohoarc; b=Gl3+16v0bN3rVYZvDwcAIKvTle6Up8JY76GnT4SrkVFhNf7EFTYAmPAuckQeIJ6mRvznIOsNeWMHudqyEchhq+UbITW11dAqsTg8SFPh98bYF4KyN4LlBsEunbahDRdKzUdSPQcx5YIyi+mwcUXDDrVL6uDVTbE8vlV3f2DeC7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629575787; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=OYEnw4LZ+Irkka4AToBBTf0I8obsEr/Vs5bLKE831Zs=; b=GgBjSt5/SUEj0pQb6XnfL2SMPCpCIFs+ck163EhYTSy3JMvb0M7G+dlKBghuOJGoxq+eCy2PvVc7qQapKq8m67dJUPcspjQhyqyVrAcjYSOBo1cKns5qSwrRKKQPyWUocI+f7DaEjl1oclRRHzXpPFbY8KM0aPNt7/2sstRfp2o= 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+79672+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 1629575787627103.42363506523645; Sat, 21 Aug 2021 12:56:27 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id J2W8YY1788612xanN6dYUaWx; Sat, 21 Aug 2021 12:56:27 -0700 X-Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.2465.1629575785218150365 for ; Sat, 21 Aug 2021 12:56:25 -0700 X-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id A620B240028 for ; Sat, 21 Aug 2021 21:56:23 +0200 (CEST) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GsTlp65sYz9rxM; Sat, 21 Aug 2021 21:56:22 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Liming Gao , Debkumar De , Harry Han , Catharine West , Vitaly Cheptsov Subject: [edk2-devel] [PATCH 1/5] MdeModulePkg/PeiCore: Align fixed-address error behaviour Date: Sat, 21 Aug 2021 19:55:47 +0000 Message-Id: <6baa44c6ee3ead5e4ffdefd5fdd3961323c323d0.1629575593.git.mhaeuser@posteo.de> In-Reply-To: References: 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,mhaeuser@posteo.de X-Gm-Message-State: cwPbMBuFczEnRIQYLoiwHKHWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629575787; bh=JKpI3BaZ5bs6bip8aoLEnzzqjmASBNWoR9p7J8kbCJ0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=foQy5m1TMqu70At6asN1WHFKRiR+fI8C/2axc6eMChO2OhK1MUX/f7JKbzM/y/5L49R ur5zWd+QXhvqs/CelSgWEpdSgfuqkO5PQQbJDpBn+wks7vEUFKsNvI506Sgn7zV3pibGv JfXXXrzl0iJ24MP9kreqTLejRJeGOtOVVYs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629575788456100013 Content-Type: text/plain; charset="utf-8" Update the control flow to take the same actions for failed fixed-address loading as if the feature was disabled. This primarily removes code duplication. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Liming Gao Cc: Debkumar De Cc: Harry Han Cc: Catharine West Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- MdeModulePkg/Core/Pei/Image/Image.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Im= age/Image.c index 5af3895191a5..94adbed82e44 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -364,18 +364,18 @@ LoadAndRelocatePeCoffImage ( AlignImageSize +=3D ImageContext.SectionAlignment; } =20 + Status =3D EFI_UNSUPPORTED; + if (PcdGet64(PcdLoadModuleAtFixAddressEnable) !=3D 0 && (Private->HobL= ist.HandoffInformationTable->BootMode !=3D BOOT_ON_S3_RESUME)) { Status =3D GetPeCoffImageFixLoadingAssignedAddress(&ImageContext, Pr= ivate); if (EFI_ERROR (Status)){ DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED ERROR: Failed= to load module at fixed address. \n")); - // - // The PEIM is not assigned valid address, try to allocate page to= load it. - // - Status =3D PeiServicesAllocatePages (EfiBootServicesCode, - EFI_SIZE_TO_PAGES ((UINT32) Ali= gnImageSize), - &ImageContext.ImageAddress); } - } else { + } + if (EFI_ERROR (Status)){ + // + // The PEIM is not assigned valid address, try to allocate page to l= oad it. + // Status =3D PeiServicesAllocatePages (EfiBootServicesCode, EFI_SIZE_TO_PAGES ((UINT32) Align= ImageSize), &ImageContext.ImageAddress); --=20 2.31.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 (#79672): https://edk2.groups.io/g/devel/message/79672 Mute This Topic: https://groups.io/mt/85048609/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- From nobody Sun May 5 15:24:16 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+79676+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+79676+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=posteo.de ARC-Seal: i=1; a=rsa-sha256; t=1629575790; cv=none; d=zohomail.com; s=zohoarc; b=OYMKv+e+2MSnltsWTj3yvReyK77XYH122FRe1QIuSXo0duForVVDAW8bnbA2XWyfvaIJ2/W5DjKmvi08Q9we1YftydruNfsYxiYKS2lPolZGtp9f4mBSpz+vJt0GtHarTumlTcrTGVz/UQ0tCjmtf9otaPdxN8Kbx29paREtLXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629575790; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1lI5LaD6tCJJB7HtjBZLacIXH3UwgSBm18i00SGy5QM=; b=HmeY3indwWiu6XnpE39+/T1ZhV8QLXkjs5gLZ7guDD45IcDs0LtzV7B1fmksR5izpqcZILutkfIzsjHrFkP3wEGLgzYNnF1XobJuC2wGlFZP1E/dl2KhGXc5CIFl17EQmVAl7V8C+I+MSOV/vkYmIqRSxqt7xBgN4UXJF/VAQTE= 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+79676+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 1629575790173164.205494934326; Sat, 21 Aug 2021 12:56:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id azu9YY1788612xRHjQun2u6q; Sat, 21 Aug 2021 12:56:29 -0700 X-Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web10.2458.1629575786244188039 for ; Sat, 21 Aug 2021 12:56:26 -0700 X-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id DF7BE240028 for ; Sat, 21 Aug 2021 21:56:23 +0200 (CEST) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GsTlq23pDz9rxL; Sat, 21 Aug 2021 21:56:23 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Vitaly Cheptsov Subject: [edk2-devel] [PATCH 2/3] ArmPkg: Use Image base address for GDB symbols loading Date: Sat, 21 Aug 2021 19:55:48 +0000 Message-Id: In-Reply-To: References: 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,mhaeuser@posteo.de X-Gm-Message-State: 331Pz4hkbV9WLnwIJ71hf2jVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629575789; bh=nTaZjYYJvwNiEbnDG6XzWjszqOKms0ziiB4yeq3N8l0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=vi3qpHL/TDFWJ6kZJlExe5zZlLv6gUjCTP23Hh8G9OzDvwUdm7o48YcgDEUToLn4AYG DEaZsDOfMuaVVoVnGG10x/gqwFYAduwzww+bQuwSJM9zxJ29oFuzsQIF+Kfh3yJD0mjkn nFSZP9J5wyBalMollKxjD2uUQJDLS9cg5gQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629575790453100037 Content-Type: text/plain; charset="utf-8" GDB symbols are currently loaded by specifying the .text section address. It is assumed to be the value of the PE/COFF SizeOfHeaders field. This may not be the case for various reasons, including a sufficiently strict Image section alignment. Use the "-o" parameter to specify the Image base address instead. This works because the GCC linker scripts are designed to emit Image section addresses that are equal to those of the final PE/COFF Image. Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c | 6 += ++--- ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActio= nLib.c b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib= .c index 3f88e84372ee..2ca42c19c03f 100644 --- a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c +++ b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c @@ -84,11 +84,11 @@ PeCoffLoaderRelocateImageExtraAction ( DEBUG ((EFI_D_LOAD | EFI_D_INFO, "load /a /ni /np %a &0x%p\n", DeCygwi= nPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(Imag= eContext->ImageAddress + ImageContext->SizeOfHeaders))); #else // Print out the command for the DS-5 to load symbols for this image - DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a 0x%p\n", DeCygwin= PathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(Image= Context->ImageAddress + ImageContext->SizeOfHeaders))); + DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a -o 0x%p\n", DeCyg= winPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)Ima= geContext->ImageAddress)); #endif #elif __GNUC__ // This may not work correctly if you generate PE/COFF directly as the= n the Offset would not be required - DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a 0x%p\n", DeCygwin= PathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(Image= Context->ImageAddress + ImageContext->SizeOfHeaders))); + DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a -o 0x%p\n", DeCyg= winPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)Ima= geContext->ImageAddress)); #else DEBUG ((EFI_D_LOAD | EFI_D_INFO, "Loading driver at 0x%11p EntryPoint= =3D0x%11p\n", (VOID *)(UINTN) ImageContext->ImageAddress, FUNCTION_ENTRY_PO= INT (ImageContext->EntryPoint))); #endif @@ -125,7 +125,7 @@ PeCoffLoaderUnloadImageExtraAction ( DEBUG ((DEBUG_LOAD | DEBUG_INFO, "unload symbols_only %a\n", DeCygwinP= athIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)))); #elif __GNUC__ // This may not work correctly if you generate PE/COFF directly as the= n the Offset would not be required - DEBUG ((DEBUG_LOAD | DEBUG_INFO, "remove-symbol-file %a 0x%08x\n", DeC= ygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(= ImageContext->ImageAddress + ImageContext->SizeOfHeaders))); + DEBUG ((DEBUG_LOAD | DEBUG_INFO, "remove-symbol-file %a 0x%08x\n", DeC= ygwinPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)I= mageContext->ImageAddress)); #else DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Unloading %a\n", ImageContext->PdbPo= inter)); #endif diff --git a/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib= .c b/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c index 80e531921c7a..0b78554f6347 100644 --- a/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c +++ b/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c @@ -116,7 +116,7 @@ PeCoffLoaderRelocateImageExtraAction ( #if (__ARMCC_VERSION < 500000) AsciiSPrint (Buffer, sizeof(Buffer), "load /a /ni /np \"%a\" &0x%08x\n",= ImageContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContex= t->SizeOfHeaders)); #else - AsciiSPrint (Buffer, sizeof(Buffer), "add-symbol-file %a 0x%08x\n", Imag= eContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContext->Si= zeOfHeaders)); + AsciiSPrint (Buffer, sizeof(Buffer), "add-symbol-file %a -o 0x%08x\n", I= mageContext->PdbPointer, (UINTN)ImageContext->ImageAddress); #endif DeCygwinPathIfNeeded (&Buffer[16]); =20 --=20 2.31.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 (#79676): https://edk2.groups.io/g/devel/message/79676 Mute This Topic: https://groups.io/mt/85048614/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- From nobody Sun May 5 15:24:16 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+79674+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+79674+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=posteo.de ARC-Seal: i=1; a=rsa-sha256; t=1629575788; cv=none; d=zohomail.com; s=zohoarc; b=cXCCXiIey/O/3FOGY6vrHVIcmHr6wZcPPIVcBUWsasOtlL0awdtyvan3SJmJbkWXEnhYoaDHm+FSGlz8OslJqBhlvOu2Q3+3+lAS1QTEEoD4uSBhcsN7IZgKnvf3NZLncDC4pOv4QX5CSSdj4LG6Vc6EVGXwsEDbgcSsXAqd9tE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629575788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=f5IhdTcHwzNwIhcoVnLSLZIjdwDi2Dygz/4nMrcwHg0=; b=CdSzKrnbzA4PBdxE52nWHpw/iC1Y/xRce65S1fvyWnlA8ny1ndyuMMGfp/o364tQntGT2Oltqp2Meyd6mwIl/SOCoUsjcdpWFkcqXymq7DcsD9N4ztHvbhdXtGoN0oGGTuVHaUyGj86U1Ze2hoO8nFYn6/szm9hudQFcCOo5aVs= 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+79674+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 162957578892091.00375449950002; Sat, 21 Aug 2021 12:56:28 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Xy6zYY1788612xx2T5mj7LW4; Sat, 21 Aug 2021 12:56:28 -0700 X-Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web11.2466.1629575785945108520 for ; Sat, 21 Aug 2021 12:56:26 -0700 X-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 401FC240107 for ; Sat, 21 Aug 2021 21:56:24 +0200 (CEST) X-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GsTlq6FDjz9rxL; Sat, 21 Aug 2021 21:56:23 +0200 (CEST) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Vitaly Cheptsov Subject: [edk2-devel] [PATCH 3/3] ArmPkg: Use Image base address for RVCT symbols loading Date: Sat, 21 Aug 2021 19:55:50 +0000 Message-Id: In-Reply-To: References: 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,mhaeuser@posteo.de X-Gm-Message-State: qoyrApBuwaGQnApqnO3R9I5Ux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629575788; bh=8he1o04njrS9eJtOQ+c6szfmj0Htqx9psqOTISIp7/Q=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=kA1RLCg1TucrUBmWhoSWxi5FSqiMYpXmQlZ3eFSR/twXxt4+BPCG1SgMUqWtIJqzxbn hcC/TEuqPSrUBBUmGIax6bqeBjPNBz0wWvoeKzgtcnaN08/Ol5GIlpF0jxUteolnBkHpC y6GeB53ixB3fA2H55FVVVwnV1VhisGR/AcY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629575790373100031 Content-Type: text/plain; charset="utf-8" The initial import of the RVCT debug code used 0 for the address of the first Image section [1]. This commit has been made in 2010, when "--ro-base 0" was still passed as a build argument [2]. In 2015, this was changed to mirror the PE/COFF memory layout the same way that ELF does [3]. Update the corresponding debug code to no longer manually account for the PE/COFF header offset. [1] https://github.com/mhaeuser/edk2/commit/62e797a489341b13a095b3cd7c0f7bd= 9eac12efe [2] https://github.com/mhaeuser/edk2/blob/62e797a489341b13a095b3cd7c0f7bd9e= ac12efe/BaseTools/Conf/tools_def.template#L2299-L2300 [3] https://github.com/tianocore/edk2/commit/b12ef6b964f8fc0532432ebffd6774= 8648487133 Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Vitaly Cheptsov Signed-off-by: Marvin H=C3=A4user --- ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c | 2 +- ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActio= nLib.c b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib= .c index 2ca42c19c03f..f65463be96b0 100644 --- a/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c +++ b/ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.c @@ -81,7 +81,7 @@ PeCoffLoaderRelocateImageExtraAction ( #ifdef __CC_ARM #if (__ARMCC_VERSION < 500000) // Print out the command for the RVD debugger to load symbols for this= image - DEBUG ((EFI_D_LOAD | EFI_D_INFO, "load /a /ni /np %a &0x%p\n", DeCygwi= nPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)(Imag= eContext->ImageAddress + ImageContext->SizeOfHeaders))); + DEBUG ((EFI_D_LOAD | EFI_D_INFO, "load /a /ni /np %a &0x%p\n", DeCygwi= nPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)Image= Context->ImageAddress)); #else // Print out the command for the DS-5 to load symbols for this image DEBUG ((EFI_D_LOAD | EFI_D_INFO, "add-symbol-file %a -o 0x%p\n", DeCyg= winPathIfNeeded (ImageContext->PdbPointer, Temp, sizeof (Temp)), (UINTN)Ima= geContext->ImageAddress)); diff --git a/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib= .c b/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c index 0b78554f6347..0a5e8db294ea 100644 --- a/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c +++ b/ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.c @@ -114,7 +114,7 @@ PeCoffLoaderRelocateImageExtraAction ( CHAR8 Buffer[256]; =20 #if (__ARMCC_VERSION < 500000) - AsciiSPrint (Buffer, sizeof(Buffer), "load /a /ni /np \"%a\" &0x%08x\n",= ImageContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContex= t->SizeOfHeaders)); + AsciiSPrint (Buffer, sizeof(Buffer), "load /a /ni /np \"%a\" &0x%08x\n",= ImageContext->PdbPointer, (UINTN)ImageContext->ImageAddress); #else AsciiSPrint (Buffer, sizeof(Buffer), "add-symbol-file %a -o 0x%08x\n", I= mageContext->PdbPointer, (UINTN)ImageContext->ImageAddress); #endif --=20 2.31.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 (#79674): https://edk2.groups.io/g/devel/message/79674 Mute This Topic: https://groups.io/mt/85048612/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-