From 91673dfdfe78906023f07e585002689e8baf654e Mon Sep 17 00:00:00 2001 From: Leendert van Doorn Date: Thu, 24 Mar 2016 15:30:08 -0500 Subject: [PATCH] ArmPlatformPkg: fixups for 64-bit pointers This retypes some stack base PCD as 64-bit, and fixes up a number of references to 64-bit PCDs (including the retypes ones), to use the correct PcdGet64() accessors. Note that, in the case of FixedPcdGet64, this does not actually caused any problems, since that resolves to an immediate value. But the generic PcdGetxx accessors should be typed according to the size of the PCD. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leo Duran [ard.biesheuvel: fixed up some instances in the 32-bit ARM code] Reviewed-by: Ard Biesheuvel --- ArmPlatformPkg/ArmPlatformPkg.dec | 6 +++--- ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S | 2 +- ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S | 2 +- ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm | 2 +- ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S | 6 +++--- ArmPlatformPkg/PrePi/PrePi.c | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index e881c13439..2d06275953 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -62,7 +62,7 @@ gArmPlatformTokenSpaceGuid.PcdClusterCount|1|UINT32|0x00000038 # Stack for CPU Cores in Secure Mode - gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0|UINT32|0x00000005 + gArmPlatformTokenSpaceGuid.PcdCPUCoresSecStackBase|0|UINT64|0x00000005 gArmPlatformTokenSpaceGuid.PcdCPUCoreSecPrimaryStackSize|0x10000|UINT32|0x00000036 gArmPlatformTokenSpaceGuid.PcdCPUCoreSecSecondaryStackSize|0x1000|UINT32|0x00000006 @@ -188,13 +188,13 @@ [PcdsFixedAtBuild.ARM] # Stack for CPU Cores in Secure Monitor Mode - gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0|UINT32|0x00000007 + gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0|UINT64|0x00000007 gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize|0x1000|UINT32|0x00000008 [PcdsFixedAtBuild.AARCH64] # The Secure World is only running in EL3. Only one set of stacks is needed for AArch64. # The Secure stacks are described by PcdCPUCoresSecStackBase, PcdCPUCoreSecPrimaryStackSize # and PcdCPUCoreSecSecondaryStackSize - gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0|UINT32|0x00000007 + gArmPlatformTokenSpaceGuid.PcdCPUCoresSecMonStackBase|0|UINT64|0x00000007 gArmPlatformTokenSpaceGuid.PcdCPUCoreSecMonStackSize|0x0|UINT32|0x00000008 diff --git a/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S index 85d3450f62..34bf3a4e68 100644 --- a/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S +++ b/ArmPlatformPkg/PrePeiCore/AArch64/PrePeiCoreEntryPoint.S @@ -60,7 +60,7 @@ ASM_PFX(MainEntryPoint): bl ASM_PFX(ArmPlatformIsPrimaryCore) // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), x1) + LoadConstantToReg (FixedPcdGet64(PcdCPUCoresStackBase), x1) LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2) add x1, x1, x2 diff --git a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S index ba1bd09b67..1693f52e26 100644 --- a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S +++ b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.S @@ -41,7 +41,7 @@ ASM_PFX(_ModuleEntryPoint): bl ASM_PFX(ArmPlatformIsPrimaryCore) // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1) + LoadConstantToReg (FixedPcdGet64(PcdCPUCoresStackBase), r1) LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) add r1, r1, r2 diff --git a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm index c316379f05..9a8ca0b174 100644 --- a/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm +++ b/ArmPlatformPkg/PrePeiCore/Arm/PrePeiCoreEntryPoint.asm @@ -43,7 +43,7 @@ _ModuleEntryPoint bl ArmPlatformIsPrimaryCore // Get the top of the primary stacks (and the base of the secondary stacks) - LoadConstantToReg (FixedPcdGet32(PcdCPUCoresStackBase), r1) + LoadConstantToReg (FixedPcdGet64(PcdCPUCoresStackBase), r1) LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2) add r1, r1, r2 diff --git a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S index f63fd44067..9538c70a23 100644 --- a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S +++ b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -49,8 +49,8 @@ _SystemMemoryEndInit: cmp x1, #0 bne _SetupStackPosition - LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), x1) - LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), x2) + LoadConstantToReg (FixedPcdGet64(PcdSystemMemoryBase), x1) + LoadConstantToReg (FixedPcdGet64(PcdSystemMemorySize), x2) sub x2, x2, #1 add x1, x1, x2 // Update the global variable @@ -61,7 +61,7 @@ _SetupStackPosition: // r1 = SystemMemoryTop // Calculate Top of the Firmware Device - LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2) + LoadConstantToReg (FixedPcdGet64(PcdFdBaseAddress), x2) LoadConstantToReg (FixedPcdGet32(PcdFdSize), x3) sub x3, x3, #1 add x3, x3, x2 // x3 = FdTop = PcdFdBaseAddress + PcdFdSize diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c index b563b5ee3a..8740b2a9e8 100644 --- a/ArmPlatformPkg/PrePi/PrePi.c +++ b/ArmPlatformPkg/PrePi/PrePi.c @@ -29,8 +29,8 @@ #include "PrePi.h" #include "LzmaDecompress.h" -#define IS_XIP() (((UINT32)FixedPcdGet32 (PcdFdBaseAddress) > mSystemMemoryEnd) || \ - ((FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) +#define IS_XIP() (((UINT64)FixedPcdGet64 (PcdFdBaseAddress) > mSystemMemoryEnd) || \ + ((FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) EFI_STATUS EFIAPI @@ -86,8 +86,8 @@ PrePiMain ( // If ensure the FD is either part of the System Memory or totally outside of the System Memory (XIP) ASSERT (IS_XIP() || - ((FixedPcdGet32 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) && - ((UINT32)(FixedPcdGet32 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT32)mSystemMemoryEnd))); + ((FixedPcdGet64 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) && + ((UINT64)(FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT64)mSystemMemoryEnd))); // Initialize the architecture specific bits ArchInitialize (); -- 2.39.2