]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/PrePi: Use the same calculation to declare the stack size as in the...
authorOlivier Martin <olivier.martin@arm.com>
Thu, 3 Apr 2014 20:05:30 +0000 (20:05 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Apr 2014 20:05:30 +0000 (20:05 +0000)
The stack size in the entrypoint (ie: $ARCH/ModuleEntryPoint.S) is calculated such as
StackSize = PrimaryCoreStack + (core_count - 1) * SecondaryCoreStack

While we were declaring the stacksize into the stack hob as:
StackSize = PrimaryCoreStack + (cluster * 8) * SecondaryCoreStack

If the number of cluster (ie: PcdClusterCount) were not defined correctly then
the stack size declaration were not correct.
It could cause stack corruption if the allocator allocates memory in this range.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15431 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/PrePi/PeiMPCore.inf
ArmPlatformPkg/PrePi/PeiUniCore.inf
ArmPlatformPkg/PrePi/PrePi.c

index 276a37226d855cccc4a5cb641df8707e5e036996..45c00b8df053727e6d75827baccb38e77b46250a 100755 (executable)
@@ -1,6 +1,6 @@
 #/** @file\r
 #  \r
-#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+#  Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>\r
 #  \r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -98,7 +98,6 @@
   gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize\r
   \r
   gArmPlatformTokenSpaceGuid.PcdCoreCount\r
-  gArmPlatformTokenSpaceGuid.PcdClusterCount\r
   gArmTokenSpaceGuid.PcdArmPrimaryCore\r
 \r
   gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
index 160374eab4fdf76c547da6faad55aa1aec0c0c5c..6079ec506f370b2835cc4d070425843692b0f616 100755 (executable)
@@ -1,6 +1,6 @@
 #/** @file\r
 #  \r
-#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+#  Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>\r
 #  \r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -93,7 +93,6 @@
   gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize\r
   \r
   gArmPlatformTokenSpaceGuid.PcdCoreCount\r
-  gArmPlatformTokenSpaceGuid.PcdClusterCount\r
 \r
   gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
   gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize\r
index d54ebf93371a54a6a5d57ec42a090e0566d7ba31..84b01b3fbe1d2cbe206491c45a0288c22a55d4b2 100755 (executable)
@@ -1,6 +1,6 @@
 /** @file\r
 *\r
-*  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
 *  are licensed and made available under the terms and conditions of the BSD License\r
@@ -139,7 +139,8 @@ PrePiMain (
 \r
   // Create the Stacks HOB (reserve the memory for all stacks)\r
   if (ArmIsMpCore ()) {\r
-    StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize) + (FixedPcdGet32(PcdClusterCount) * 4 * FixedPcdGet32(PcdCPUCoreSecondaryStackSize));\r
+    StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize) +\r
+                 ((FixedPcdGet32 (PcdCoreCount) - 1) * FixedPcdGet32 (PcdCPUCoreSecondaryStackSize));\r
   } else {\r
     StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize);\r
   }\r