ArmVirtPkg: clean up FP enabling code

UEFI defines that FP support is required on AArch64, whereas ArmVirtPkg
enables it anyway on Arm. But when it's enabled, C code can generate
instructions targeting FP registers, so:

- move ArmEnableVFP call to asm
- make it unconditional on AArch64

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
This commit is contained in:
Leif Lindholm
2025-04-08 14:09:54 +01:00
committed by mergify[bot]
parent 7fe2436480
commit 0368687299
3 changed files with 6 additions and 6 deletions

View File

@@ -20,11 +20,9 @@ ASM_FUNC(_ModuleEntryPoint)
0:mov x28, x0 // preserve DTB pointer
mov x27, x1 // preserve base of image pointer
#if (FixedPcdGet32 (PcdVFPEnabled))
// Enable Floating Point. This needs to be done before entering C code, which
// may use FP/SIMD registers.
bl ArmEnableVFP
#endif
bl ASM_PFX(DiscoverDramFromDt)

View File

@@ -13,8 +13,4 @@ ArchInitialize (
VOID
)
{
// Enable Floating Point
if (FixedPcdGet32 (PcdVFPEnabled)) {
ArmEnableVFP ();
}
}

View File

@@ -12,6 +12,12 @@ ASM_FUNC(_ModuleEntryPoint)
// Do early platform specific actions
bl ASM_PFX(ArmPlatformPeiBootAction)
#if (FixedPcdGet32 (PcdVFPEnabled))
// Enable Floating Point. AArch64 uses hardfloat ABI so needs this done before
// calling any C code. Arm does not, but let's keep the ports aligned.
bl ArmEnableVFP
#endif
// Get ID of this CPU in Multicore system
bl ASM_PFX(ArmReadMpidr)
// Keep a copy of the MpId register value