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 <sami.mujawar@arm.com>
This commit is contained in:
Sami Mujawar 2026-05-21 08:06:17 +01:00 committed by mergify[bot]
parent 2b842a2081
commit 084ce2b04b

View file

@ -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