summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/PrePeiCore
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-11 12:03:00 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2011-06-11 12:03:00 +0000
commit47a8e12fe162f7c9c1deefde7bed912a860c4223 (patch)
treef5e8984f752c46a6df23f1f1872a65ae9b46ca4f /ArmPlatformPkg/PrePeiCore
parent936eff09c3d5297aa4cdf69da2b89a69666bf9c9 (diff)
downloadedk2-47a8e12fe162f7c9c1deefde7bed912a860c4223.tar.gz
edk2-47a8e12fe162f7c9c1deefde7bed912a860c4223.tar.bz2
edk2-47a8e12fe162f7c9c1deefde7bed912a860c4223.zip
ArmPlatformPkg/PrePeiCore: Reserve some memory on the top of the stack for Global Variables in XIP code
The size of this memory is controlled by a PCD. The Global Variable in this regsion are defined by their offset. This memory region can be use to store the PEI Services Table Pointer. Update the PeiServicesTablePointerLib to use this region instead of PcdPeiServicePtrAddr. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11803 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/PrePeiCore')
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S33
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm24
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf2
-rw-r--r--ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf2
4 files changed, 41 insertions, 20 deletions
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S b/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S
index 53c16ccb6f..ffa4a46da9 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.S
@@ -1,22 +1,21 @@
//
// Copyright (c) 2011, 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
-# which accompanies this distribution. The full text of the license may be found at
-# http:#opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
+// This program and the accompanying materials
+// are licensed and made available under the terms and conditions of the BSD License
+// which accompanies this distribution. The full text of the license may be found at
+// http://opensource.org/licenses/bsd-license.php
+//
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+//
+//
#include <AsmMacroIoLib.h>
#include <Base.h>
#include <Library/PcdLib.h>
#include <AutoGen.h>
-#start of the code section
.text
.align 3
@@ -45,9 +44,17 @@ _SetupStack:
add r3,r3,r2,LSR #1 @ r3 = stack_offset + (stack_size/2) <-- the top half is for the heap
mov sp, r3
- # lr points to area in reset vector block containing PEI core address. lr needs to
- # be saved from the beginning as the _ModuleEntryPoint could call helper functions
- # that will overwrite 'lr'
+ # Only allocate memory in top of the primary core stack
+ cmp r0, #0
+ bne _PrepareArguments
+
+_AllocateGlobalPeiVariables:
+ # Reserve top of the stack for Global PEI Variables (eg: PeiServicesTablePointer)
+ LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r1)
+ sub sp, sp, r1
+
+_PrepareArguments:
+ # The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
LoadConstantToReg (FixedPcdGet32(PcdNormalFdBaseAddress), r2)
add r2, r2, #4
ldr r1, [r2]
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm b/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm
index de5fac15f8..231c14e36b 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreEntryPoint.asm
@@ -33,15 +33,25 @@ _ModuleEntryPoint
_SetupStack
// Setup Stack for the 4 CPU cores
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackBase) ,r1)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackSize) ,r2)
+ LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackBase), r1)
+ LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackSize), r2)
- mov r3,r0 // r3 = core_id
- mul r3,r3,r2 // r3 = core_id * stack_size = offset from the stack base
- add r3,r3,r1 // r3 = stack_base + offset
- add r3,r3,r2,LSR #1 // r3 = stack_offset + (stack_size/2) <-- the top half is for the heap
- mov sp, r3
+ mov r3, r0 // r3 = core_id
+ mul r3, r3, r2 // r3 = core_id * stack_size = offset from the stack base
+ add r3, r3, r1 // r3 = stack_base + offset
+ add r3, r3, r2, LSR #1 // r3 = stack_offset + (stack_size/2) <-- the top half is for the heap
+ mov sp, r3
+ // Only allocate memory in top of the primary core stack
+ cmp r0, #0
+ bne _PrepareArguments
+
+_AllocateGlobalPeiVariables
+ // Reserve top of the stack for Global PEI Variables (eg: PeiServicesTablePointer)
+ LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r1)
+ sub sp, sp, r1
+
+_PrepareArguments
// The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector
LoadConstantToReg (FixedPcdGet32(PcdNormalFdBaseAddress), r2)
add r2, r2, #4
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
index 385b407363..4ca81f5a40 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
@@ -59,5 +59,7 @@
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
+
gArmTokenSpaceGuid.PcdGicDistributorBase
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
index 58b8e339ed..c14e7353c6 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
@@ -57,5 +57,7 @@
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize
+ gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
+
gArmTokenSpaceGuid.PcdGicDistributorBase
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase