\r
_SetupStack\r
// Setup Stack for the 4 CPU cores\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackBase) ,r1)\r
- LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackSize) ,r2)\r
+ LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackBase), r1)\r
+ LoadConstantToReg (FixedPcdGet32(PcdCPUCoresNonSecStackSize), r2)\r
\r
- mov r3,r0 // r3 = core_id\r
- mul r3,r3,r2 // r3 = core_id * stack_size = offset from the stack base\r
- add r3,r3,r1 // r3 = stack_base + offset\r
- add r3,r3,r2,LSR #1 // r3 = stack_offset + (stack_size/2) <-- the top half is for the heap\r
- mov sp, r3\r
+ mov r3, r0 // r3 = core_id\r
+ mul r3, r3, r2 // r3 = core_id * stack_size = offset from the stack base\r
+ add r3, r3, r1 // r3 = stack_base + offset\r
+ add r3, r3, r2, LSR #1 // r3 = stack_offset + (stack_size/2) <-- the top half is for the heap\r
+ mov sp, r3\r
\r
+ // Only allocate memory in top of the primary core stack\r
+ cmp r0, #0\r
+ bne _PrepareArguments\r
+\r
+_AllocateGlobalPeiVariables\r
+ // Reserve top of the stack for Global PEI Variables (eg: PeiServicesTablePointer)\r
+ LoadConstantToReg (FixedPcdGet32(PcdPeiGlobalVariableSize), r1)\r
+ sub sp, sp, r1\r
+\r
+_PrepareArguments\r
// The PEI Core Entry Point has been computed by GenFV and stored in the second entry of the Reset Vector\r
- LoadConstantToReg (FixedPcdGet32(PcdNormalFdBaseAddress), r2)\r
+ LoadConstantToReg (FixedPcdGet32(PcdNormalFvBaseAddress), r2)\r
add r2, r2, #4\r
ldr r1, [r2]\r
\r