summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/PrePi/AArch64
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPlatformPkg/PrePi/AArch64')
-rw-r--r--ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S27
1 files changed, 20 insertions, 7 deletions
diff --git a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
index fcea9496cb..2c4a7e5324 100644
--- a/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
+++ b/ArmPlatformPkg/PrePi/AArch64/ModuleEntryPoint.S
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2011-2013, ARM Limited. All rights reserved.
+// Copyright (c) 2011-2015, ARM Limited. All rights reserved.
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
@@ -24,8 +24,10 @@ GCC_ASM_IMPORT(ArmReadMpidr)
GCC_ASM_IMPORT(ArmPlatformPeiBootAction)
GCC_ASM_IMPORT(ArmPlatformStackSet)
GCC_ASM_EXPORT(_ModuleEntryPoint)
+GCC_ASM_EXPORT(mSystemMemoryEnd)
-StartupAddr: .8byte ASM_PFX(CEntryPoint)
+StartupAddr: .8byte ASM_PFX(CEntryPoint)
+mSystemMemoryEnd: .8byte 0
ASM_PFX(_ModuleEntryPoint):
// Do early platform specific actions
@@ -40,12 +42,23 @@ _SetSVCMode:
// 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)
-_SetupStackPosition:
- // Compute Top of System Memory
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemoryBase), x1)
- LoadConstantToReg (FixedPcdGet64 (PcdSystemMemorySize), x2)
+_SystemMemoryEndInit:
+ ldr x1, mSystemMemoryEnd
+
+ // Is mSystemMemoryEnd initialized?
+ cmp x1, #0
+ bne _SetupStackPosition
+
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), x1)
+ LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), x2)
sub x2, x2, #1
- add x1, x1, x2 // x1 = SystemMemoryTop = PcdSystemMemoryBase + PcdSystemMemorySize
+ add x1, x1, x2
+ // Update the global variable
+ adr x2, mSystemMemoryEnd
+ str x1, [x2]
+
+_SetupStackPosition:
+ // r1 = SystemMemoryTop
// Calculate Top of the Firmware Device
LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), x2)