public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb@kernel.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Michael Kubacki <michael.kubacki@microsoft.com>,
	Oliver Steffen <osteffen@redhat.com>
Subject: [PATCH 1/3] ArmVirtPkg/PrePi: Ensure timely execution of library constructors
Date: Thu, 19 Jan 2023 09:21:51 +0100	[thread overview]
Message-ID: <20230119082153.1520196-2-ardb@kernel.org> (raw)
In-Reply-To: <20230119082153.1520196-1-ardb@kernel.org>

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 <ardb@kernel.org>
---
 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), PcdGet32 (PcdFdSize));
 
+  // SEC phase needs to run library constructors by hand.
+  ProcessLibraryConstructorList ();
+
   // Initialize MMU and Memory HOBs (Resource Descriptor HOBs)
   Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize));
   ASSERT_EFI_ERROR (Status);
@@ -93,9 +96,6 @@ PrePiMain (
   // Now, the HOB List has been initialized, we can register performance information
   PERF_START (NULL, "PEI", NULL, StartTimeStamp);
 
-  // SEC phase needs to run library constructors by hand.
-  ProcessLibraryConstructorList ();
-
   // Assume the FV that contains the SEC (our code) also contains a compressed FV.
   Status = DecompressFirstFv ();
   ASSERT_EFI_ERROR (Status);
-- 
2.39.0


  reply	other threads:[~2023-01-19  8:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  8:21 [PATCH 0/3] ArmVirtPkg: Increase PlatformCI coverage Ard Biesheuvel
2023-01-19  8:21 ` Ard Biesheuvel [this message]
2023-01-19  8:21 ` [PATCH 2/3] ArmVirtPkg: CI: Perform build and boot test of ArmVirtQemuKernel Ard Biesheuvel
2023-01-19  9:14   ` Gerd Hoffmann
2023-01-23 16:07     ` Ard Biesheuvel
2023-01-19  8:21 ` [PATCH 3/3] ArmVirtPkg: CI: Perform build test of ArmVirtKvmTool Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230119082153.1520196-2-ardb@kernel.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox