mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
ArmPlatformPkg/Sec: clean up FP enabling code
UEFI defines that FP support is required on AArch64, whereas many platforms enable 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:
parent
0368687299
commit
6952d1fa90
8 changed files with 22 additions and 16 deletions
|
|
@ -18,11 +18,6 @@ ArchInitialize (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
// Enable Floating Point
|
||||
if (FixedPcdGet32 (PcdVFPEnabled)) {
|
||||
ArmEnableVFP ();
|
||||
}
|
||||
|
||||
if (ArmReadCurrentEL () == AARCH64_EL2) {
|
||||
// Trap General Exceptions. All exceptions that would be routed to EL1 are routed to EL2
|
||||
ArmWriteHcr (ARM_HCR_TGE);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ ASM_FUNC(_ModuleEntryPoint)
|
|||
// Do early platform specific actions
|
||||
bl ASM_PFX(ArmPlatformPeiBootAction)
|
||||
|
||||
// Enable Floating Point. This needs to be done before entering C code, which
|
||||
// may use FP/SIMD registers.
|
||||
bl ArmEnableVFP
|
||||
|
||||
// Check if we can install the stack at the top of the System Memory or if we need
|
||||
// to install the stacks at the bottom of the Firmware Device (case the FD is located
|
||||
// at the top of the DRAM)
|
||||
|
|
|
|||
|
|
@ -18,8 +18,4 @@ ArchInitialize (
|
|||
{
|
||||
// Enable program flow prediction, if supported.
|
||||
ArmEnableBranchPrediction ();
|
||||
|
||||
if (FixedPcdGet32 (PcdVFPEnabled)) {
|
||||
ArmEnableVFP ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ ASM_FUNC(_ModuleEntryPoint)
|
|||
// Do early platform specific actions
|
||||
bl ASM_PFX(ArmPlatformPeiBootAction)
|
||||
|
||||
#if (FixedPcdGet32 (PcdVFPEnabled))
|
||||
// Enable Floating Point. This needs to be done before entering C code, which
|
||||
// may use FP/SIMD registers.
|
||||
bl ArmEnableVFP
|
||||
#endif
|
||||
|
||||
// Check if we can install the stack at the top of the System Memory or if we need
|
||||
// to install the stacks at the bottom of the Firmware Device (case the FD is located
|
||||
// at the top of the DRAM)
|
||||
|
|
|
|||
|
|
@ -70,9 +70,11 @@
|
|||
gArmTokenSpaceGuid.PcdFdSize
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||
gArmTokenSpaceGuid.PcdFvSize
|
||||
gArmTokenSpaceGuid.PcdVFPEnabled
|
||||
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize
|
||||
|
||||
[FixedPcd.ARM]
|
||||
gArmTokenSpaceGuid.PcdVFPEnabled
|
||||
|
||||
[Pcd]
|
||||
gArmTokenSpaceGuid.PcdSystemMemoryBase
|
||||
gArmTokenSpaceGuid.PcdSystemMemorySize
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@ ASM_FUNC(_ModuleEntryPoint)
|
|||
// Do early platform specific actions
|
||||
bl ASM_PFX(ArmPlatformPeiBootAction)
|
||||
|
||||
#if (FixedPcdGet32 (PcdVFPEnabled))
|
||||
// Enable Floating Point. This needs to be done before entering C code, which
|
||||
// may use FP/SIMD registers.
|
||||
bl ArmEnableVFP
|
||||
#endif
|
||||
|
||||
// Get the top of the primary stacks (and the base of the secondary stacks)
|
||||
MOV32 (r1, FixedPcdGet64(PcdCPUCoresStackBase) + FixedPcdGet32(PcdCPUCorePrimaryStackSize))
|
||||
|
||||
|
|
|
|||
|
|
@ -223,11 +223,6 @@ CEntryPoint (
|
|||
ASSERT (((UINTN)PeiVectorTable & ARM_VECTOR_TABLE_ALIGNMENT) == 0);
|
||||
ArmWriteVBar ((UINTN)PeiVectorTable);
|
||||
|
||||
// Enable Floating Point
|
||||
if (FixedPcdGet32 (PcdVFPEnabled)) {
|
||||
ArmEnableVFP ();
|
||||
}
|
||||
|
||||
// Invoke "ProcessLibraryConstructorList" to have all library constructors
|
||||
// called.
|
||||
ProcessLibraryConstructorList ();
|
||||
|
|
|
|||
|
|
@ -58,9 +58,11 @@
|
|||
[FixedPcd]
|
||||
gArmTokenSpaceGuid.PcdFvBaseAddress
|
||||
gArmTokenSpaceGuid.PcdFvSize
|
||||
gArmTokenSpaceGuid.PcdVFPEnabled
|
||||
|
||||
gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase
|
||||
gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
|
||||
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
|
||||
|
||||
[FixedPcd.ARM]
|
||||
gArmTokenSpaceGuid.PcdVFPEnabled
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue