]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePi/ModuleEntryPoint.asm
ArmPlatformPkg: Introduction of gArmPlatformTokenSpaceGuid.PcdCoreCount
[mirror_edk2.git] / ArmPlatformPkg / PrePi / ModuleEntryPoint.asm
index 0c7299a995fb1b7c8f25bf182ccc1f31722f0b25..3437818b52a4d4cb4aa03a87cc58f0cdbe9c4a97 100644 (file)
@@ -20,7 +20,8 @@
   \r
   IMPORT  CEntryPoint\r
   IMPORT  ArmReadMpidr\r
-  IMPORT  ArmIsMpCore\r
+  IMPORT  ArmPlatformStackSet\r
+  \r
   EXPORT  _ModuleEntryPoint\r
 \r
   PRESERVE8\r
@@ -107,11 +108,20 @@ _GetStackBaseMpCore
   // r1 = The top of the Mpcore Stacks\r
   // Stack for the primary core = PrimaryCoreStack\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
-  sub   r7, r1, r2\r
-\r
-  // Stack for the secondary core = Number of Clusters * (4 Cores per cluster) * SecondaryStackSize\r
-  LoadConstantToReg (FixedPcdGet32(PcdClusterCount), r2)\r
-  lsl   r2, r2, #2\r
+  sub   r8, r1, r2\r
+\r
+  // Stack for the secondary core = Number of Cores - 1\r
+  LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0)\r
+  sub  r0, r0, #1\r
+  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1)\r
+  mul   r1, r1, r0\r
+  sub   r8, r8, r1\r
+\r
+  // r8 = The base of the MpCore Stacks (primary stack & secondary stacks)\r
+  mov  r0, r8\r
+  mov  r1, r6\r
+  //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)\r
+  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
   LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3)\r
   mul   r2, r2, r3\r
   sub   r7, r7, r2\r