From 084ce2b04bdd9b3ed8f2a1eb51d09355c04c692c Mon Sep 17 00:00:00 2001 From: Sami Mujawar Date: Thu, 21 May 2026 08:06:17 +0100 Subject: [PATCH] ArmVirtPkg: Clear TPIDR_EL0 before early HOB lookups TPIDR_EL0 is used to hold the PrePi HOB list pointer, but its reset value is unknown. Some early boot paths can call GetHobList() before PrePiMain() creates and installs the HOB list. Clear TPIDR_EL0 at the SEC entry point so those early lookups see NULL rather than an invalid pointer. Signed-off-by: Sami Mujawar --- ArmVirtPkg/PrePi/ModuleEntryPoint.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ArmVirtPkg/PrePi/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/ModuleEntryPoint.S index 92272eaf52..71601e3275 100644 --- a/ArmVirtPkg/PrePi/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/ModuleEntryPoint.S @@ -1,5 +1,5 @@ // -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// Copyright (c) 2011-2026, ARM Limited. All rights reserved. // Copyright (c) 2015-2016, Linaro Limited. All rights reserved. // // SPDX-License-Identifier: BSD-2-Clause-Patent @@ -20,6 +20,12 @@ ASM_FUNC(_ModuleEntryPoint) 0:mov x28, x0 // preserve DTB pointer mov x27, x1 // preserve base of image pointer + // The TPIDR_EL0 register is used to store the HobList pointer. + // The register value is unknown at reset, so clear the register + // to prevent early callers of GetHobList(), i.e. before the HOB list + // has been setup in PrePiMain() from getting an invalid value. + msr tpidr_el0, xzr + // Enable Floating Point. This needs to be done before entering C code, which // may use FP/SIMD registers. bl ArmEnableVFP