From nobody Sat Feb 7 19:08:28 2026 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+98874+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+98874+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1674116527; cv=none; d=zohomail.com; s=zohoarc; b=a6RnvfyxGi6E1wLiK3cOWAgoauz5OxrfH15YO47tPanNmuNe90Hp/iNY/VEksZbsL1NmBRBzsOmy+ci4l7KbPoeSgvuWpPeqXRk/Ph3wa2U3Stx4nhfjN0qyck+nBoFtBKdP5g8uxJ9HNYe50FRwA5ZxNKLtf47881z3uE8Ojrs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674116527; h=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=h6dKJd4KBuctIv1uVE1hytLWctz+YQpnLHzEjoZ0Ke8=; b=FKHlGZAkf+VtR4XZzEX4RIUAQplQpdvU3WoyPz3ThyFEOEuoJ8hi90h97EdUVEVARCuitUhk3HvcRPPB4UeUcdmvQMg3I1vJrWpMptVxOl2J2vfbQByup0uDwXHqW1MPGzK5jhqQ2Y/hK5cIEbPe4Cvc8oLKqHikusUU3KDSKs4= 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+98874+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 1674116527286128.920042508576; Thu, 19 Jan 2023 00:22:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id t4DnYY1788612xwe1qBawd6p; Thu, 19 Jan 2023 00:22:07 -0800 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.40754.1674116526507237338 for ; Thu, 19 Jan 2023 00:22:06 -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 dfw.source.kernel.org (Postfix) with ESMTPS id F3CD761209; Thu, 19 Jan 2023 08:22:05 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41093C433F1; Thu, 19 Jan 2023 08:22:04 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Gerd Hoffmann , Michael Kubacki , Oliver Steffen Subject: [edk2-devel] [PATCH 1/3] ArmVirtPkg/PrePi: Ensure timely execution of library constructors Date: Thu, 19 Jan 2023 09:21:51 +0100 Message-Id: <20230119082153.1520196-2-ardb@kernel.org> In-Reply-To: <20230119082153.1520196-1-ardb@kernel.org> References: <20230119082153.1520196-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: XkGGItt6Gt1t941B1omHAs2ex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1674116527; bh=U7XYsWLlNG0NmBIIbZmFk+CPI9wfbQsoCL2LWzrHRTM=; h=Cc:Date:From:Reply-To:Subject:To; b=Blxf3aZ/sAeXlsg5dkLnERzapj+Vxhi3ov9VGFJKEmSx9vw5lAoeMJvc0dO4ztBGpzr ARjIFdP/kl8fqthIkXoAdWlK+Xbxes7HaHXV8ae6jvEptne2V9hQ80WHu1opKMs9ZW9yW 9TXq+e0diU5v3HxRgD+t++rAejrEZivXL/E= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1674116529273100006 Content-Type: text/plain; charset="utf-8" PrePi has a bare metal entry point, and so it is in charge of calling the library constructors once the C runtime has been initialized sufficiently. However, we are now relying on a HOB to have been constructed by the time the MMU code runs, and so the constructors should be run before that. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/PrePi/PrePi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ArmVirtPkg/PrePi/PrePi.c b/ArmVirtPkg/PrePi/PrePi.c index c15dc305fced..3d943b2138d3 100755 --- a/ArmVirtPkg/PrePi/PrePi.c +++ b/ArmVirtPkg/PrePi/PrePi.c @@ -60,6 +60,9 @@ PrePiMain ( // InvalidateDataCacheRange ((VOID *)(UINTN)PcdGet64 (PcdFdBaseAddress), Pc= dGet32 (PcdFdSize)); =20 + // SEC phase needs to run library constructors by hand. + ProcessLibraryConstructorList (); + // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) Status =3D MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUef= iRegionSize)); ASSERT_EFI_ERROR (Status); @@ -93,9 +96,6 @@ PrePiMain ( // Now, the HOB List has been initialized, we can register performance i= nformation PERF_START (NULL, "PEI", NULL, StartTimeStamp); =20 - // SEC phase needs to run library constructors by hand. - ProcessLibraryConstructorList (); - // Assume the FV that contains the SEC (our code) also contains a compre= ssed FV. Status =3D DecompressFirstFv (); ASSERT_EFI_ERROR (Status); --=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 (#98874): https://edk2.groups.io/g/devel/message/98874 Mute This Topic: https://groups.io/mt/96373698/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-