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 // Add size of primary stack to StackBase
63 // Compute SecondaryCoresCount * SecondaryCoreStackSize
64 MOV32 (w1, FixedPcdGet32(PcdCoreCount) - 1)
67 // Set Primary Stack ((StackBase + PrimaryStackSize) + (SecondaryCoresCount * SecondaryCoreStackSize))
73 //ArmPlatformStackSetSecondary (
74 // IN UINTN StackBase,
76 // IN UINTN PrimaryStackSize,
77 // IN UINTN SecondaryStackSize
79 ASM_FUNC(ArmPlatformStackSetSecondary)
80 // Save the Link register
86 bl ASM_PFX(ArmPlatformGetCorePosition)
89 // Get Primary Core Position
90 bl ASM_PFX(ArmPlatformGetPrimaryCoreMpId)
91 bl ASM_PFX(ArmPlatformGetCorePosition)
93 // Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)
96 // Decrement the position if after the primary core
99 // Compute top of the secondary stack