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
#/** @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
gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize\r
\r
gArmPlatformTokenSpaceGuid.PcdCoreCount\r
- gArmPlatformTokenSpaceGuid.PcdClusterCount\r
gArmTokenSpaceGuid.PcdArmPrimaryCore\r
\r
gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
#/** @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
gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize\r
\r
gArmPlatformTokenSpaceGuid.PcdCoreCount\r
- gArmPlatformTokenSpaceGuid.PcdClusterCount\r
\r
gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize\r
/** @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
\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