2 // Copyright (c) 2012-2014, ARM Limited. All rights reserved.
4 // This program and the accompanying materials
5 // are licensed and made available under the terms and conditions of the BSD License
6 // which accompanies this distribution. The full text of the license may be found at
7 // http://opensource.org/licenses/bsd-license.php
9 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #include <AsmMacroIoLibV8.h>
17 //ArmPlatformStackSet (
18 // IN UINTN StackBase,
20 // IN UINTN PrimaryStackSize,
21 // IN UINTN SecondaryStackSize
23 ASM_FUNC(ArmPlatformStackSet)
30 // Save the Link register
35 bl ASM_PFX(ArmPlatformIsPrimaryCore)
44 // Restore the Link register
49 b ASM_PFX(ArmPlatformStackSetPrimary)
50 0:b ASM_PFX(ArmPlatformStackSetSecondary)
53 //ArmPlatformStackSetPrimary (
54 // IN UINTN StackBase,
56 // IN UINTN PrimaryStackSize,
57 // IN UINTN SecondaryStackSize
59 ASM_FUNC(ArmPlatformStackSetPrimary)
60 // Save the Link register
63 // Add stack of primary stack to StackBase
66 // Compute SecondaryCoresCount * SecondaryCoreStackSize
67 MOV32 (w1, FixedPcdGet32(PcdCoreCount) - 1)
70 // Set Primary Stack ((StackBase + PrimaryStackSize) + (SecondaryCoresCount * SecondaryCoreStackSize))
76 //ArmPlatformStackSetSecondary (
77 // IN UINTN StackBase,
79 // IN UINTN PrimaryStackSize,
80 // IN UINTN SecondaryStackSize
82 ASM_FUNC(ArmPlatformStackSetSecondary)
83 // Save the Link register
89 bl ASM_PFX(ArmPlatformGetCorePosition)
92 // Get Primary Core Position
93 bl ASM_PFX(ArmPlatformGetPrimaryCoreMpId)
94 bl ASM_PFX(ArmPlatformGetCorePosition)
96 // Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)
99 // Decrement the position if after the primary core
104 // Compute top of the secondary stack