diff options
author | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-02-28 17:23:53 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-02-28 17:23:53 +0000 |
commit | 1377db63ff80bbb28da572c7b276ba56faea5f94 (patch) | |
tree | 40938c5d1960667bed42eb0e87da13a120fc8420 /ArmPlatformPkg/PrePi/ModuleEntryPoint.S | |
parent | 2569b068685b126c64753c280f339e1e6869d068 (diff) | |
download | edk2-platforms-1377db63ff80bbb28da572c7b276ba56faea5f94.tar.xz |
ArmPlatformPkg: Updated the stack setup to have the same geometry between the Secure and Normal World
Having a similar setup reduces the error during the MPCore stack setup.
The stack setup is described on this wikipage:
https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=ArmPlatformPkg/Stack
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13058 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/PrePi/ModuleEntryPoint.S')
-rwxr-xr-x | ArmPlatformPkg/PrePi/ModuleEntryPoint.S | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S b/ArmPlatformPkg/PrePi/ModuleEntryPoint.S index fe9117218a..52e50921b8 100755 --- a/ArmPlatformPkg/PrePi/ModuleEntryPoint.S +++ b/ArmPlatformPkg/PrePi/ModuleEntryPoint.S @@ -103,6 +103,7 @@ _GetStackBase: beq _SetupUnicoreStack
_GetStackBaseMpCore:
+ // r1 = The top of the Mpcore Stacks
// Stack for the primary core = PrimaryCoreStack
LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
sub r7, r1, r2
@@ -113,8 +114,12 @@ _GetStackBaseMpCore: mul r2, r2, r3
sub r7, r7, r2
- // The top of the Mpcore Stacks is in r1
- // The base of the MpCore Stacks is in r7
+ // The base of the secondary Stacks = Top of Primary stack
+ LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)
+ add r1, r7, r2
+
+ // r7 = The base of the MpCore Stacks
+ // r1 = The base of the secondary Stacks = Top of the Primary stack
// Is it the Primary Core ?
LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCore), r4)
@@ -122,7 +127,7 @@ _GetStackBaseMpCore: beq _SetupPrimaryCoreStack
_SetupSecondaryCoreStack:
- // Base of the stack for the secondary cores is in r7
+ // r1 = The base of the secondary Stacks
// Get the position of the cores (ClusterId * 4) + CoreId
GetCorePositionInStack(r0, r5, r4)
@@ -130,28 +135,28 @@ _SetupSecondaryCoreStack: add r0, r0, #1
// Get the offset for the Secondary Stack
mul r0, r0, r3
- add sp, r7, r0
+ add sp, r1, r0
bne _PrepareArguments
_SetupPrimaryCoreStack:
- // The top of the Mpcore Stacks is in r1
+ // r1 = Top of the primary stack
LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2)
+ b _PreparePrimaryStack
+
+_SetupUnicoreStack:
+ // The top of the Unicore Stack is in r1
+ LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2)
+ LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r3)
+ // Calculate the bottom of the primary stack (StackBase)
+ sub r7, r1, r3
+
+_PreparePrimaryStack:
// The reserved space for global variable must be 8-bytes aligned for pushing
// 64-bit variable on the stack
SetPrimaryStack (r1, r2, r3)
-_SetGlobals:
- // Set all the PrePi global variables to 0
- mov r3, sp
- mov r2, #0x0
-_InitGlobals:
- cmp r3, r1
- beq _PrepareArguments
- str r2, [r3], #4
- b _InitGlobals
-
_PrepareArguments:
mov r0, r5
mov r1, r6
@@ -172,17 +177,3 @@ _PrepareArguments: _NeverReturn:
b _NeverReturn
-_SetupUnicoreStack:
- // The top of the Unicore Stack is in r1
- LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r2)
- LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r3)
-
- // Calculate the bottom of the primary stack (StackBase)
- sub r7, r1, r3
-
- // The reserved space for global variable must be 8-bytes aligned for pushing
- // 64-bit variable on the stack
- SetPrimaryStack (r1, r2, r3)
-
- b _SetGlobals
-
|