GCC_ASM_EXPORT(ArmPlatformStackSetPrimary)\r
GCC_ASM_EXPORT(ArmPlatformStackSetSecondary)\r
\r
+GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
GCC_ASM_IMPORT(ArmPlatformGetCorePosition)\r
+GCC_ASM_IMPORT(ArmPlatformGetPrimaryCoreMpId)\r
\r
GCC_ASM_IMPORT(gPcd_FixedAtBuild_PcdCoreCount)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
\r
//VOID\r
//ArmPlatformStackSet (\r
// IN UINTN SecondaryStackSize\r
// );\r
ASM_PFX(ArmPlatformStackSet):\r
+ // Save parameters\r
+ mov r6, r3\r
+ mov r5, r2\r
+ mov r4, r1\r
+ mov r3, r0\r
+\r
+ // Save the Link register\r
+ mov r7, lr\r
+\r
// Identify Stack\r
- // Mask for ClusterId|CoreId\r
- LoadConstantToReg (0xFFFF, r4)\r
- and r1, r1, r4\r
- // Is it the Primary Core ?\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r4)\r
- ldr r4, [r4]\r
- cmp r1, r4\r
+ mov r0, r1\r
+ bl ASM_PFX(ArmPlatformIsPrimaryCore)\r
+ cmp r0, #1\r
+\r
+ // Restore parameters\r
+ mov r0, r3\r
+ mov r1, r4\r
+ mov r2, r5\r
+ mov r3, r6\r
+\r
+ // Restore the Link register\r
+ mov lr, r7\r
+\r
beq ASM_PFX(ArmPlatformStackSetPrimary)\r
bne ASM_PFX(ArmPlatformStackSetSecondary)\r
\r
mov r5, r0\r
\r
// Get Primary Core Position\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
- ldr r0, [r0]\r
+ bl ASM_PFX(ArmPlatformGetPrimaryCoreMpId)\r
bl ASM_PFX(ArmPlatformGetCorePosition)\r
\r
// Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)\r
//\r
-// Copyright (c) 2012, ARM Limited. All rights reserved.\r
+// Copyright (c) 2012-2013, 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
EXPORT ArmPlatformStackSetPrimary\r
EXPORT ArmPlatformStackSetSecondary\r
\r
+ IMPORT ArmPlatformIsPrimaryCore\r
IMPORT ArmPlatformGetCorePosition\r
+ IMPORT ArmPlatformGetPrimaryCoreMpId\r
\r
IMPORT _gPcd_FixedAtBuild_PcdCoreCount\r
- IMPORT _gPcd_FixedAtBuild_PcdArmPrimaryCore\r
\r
PRESERVE8\r
AREA ArmPlatformStackLib, CODE, READONLY\r
// IN UINTN SecondaryStackSize\r
// );\r
ArmPlatformStackSet FUNCTION\r
+ // Save parameters\r
+ mov r6, r3\r
+ mov r5, r2\r
+ mov r4, r1\r
+ mov r3, r0\r
+\r
+ // Save the Link register\r
+ mov r7, lr\r
+\r
// Identify Stack\r
- // Mask for ClusterId|CoreId\r
- LoadConstantToReg (0xFFFF, r4)\r
- and r1, r1, r4\r
- // Is it the Primary Core ?\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r4)\r
- ldr r4, [r4]\r
- cmp r1, r4\r
+ mov r0, r1\r
+ bl ArmPlatformIsPrimaryCore\r
+ cmp r0, #1\r
+\r
+ // Restore parameters\r
+ mov r0, r3\r
+ mov r1, r4\r
+ mov r2, r5\r
+ mov r3, r6\r
+\r
+ // Restore the Link register\r
+ mov lr, r7\r
+\r
beq ArmPlatformStackSetPrimary\r
bne ArmPlatformStackSetSecondary\r
ENDFUNC\r
mov r5, r0\r
\r
// Get Primary Core Position\r
- LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
- ldr r0, [r0]\r
+ bl ArmPlatformGetPrimaryCoreMpId\r
bl ArmPlatformGetCorePosition\r
\r
// Get Secondary Core Position. We should get consecutive secondary stack number from 1...(CoreCount-1)\r