]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/ArmPlatformStackLib: switch to ASM_FUNC() asm macro
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 10 Aug 2016 14:55:23 +0000 (16:55 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 11 Aug 2016 11:25:06 +0000 (13:25 +0200)
Annotate functions with ASM_FUNC() so that they are emitted into
separate sections.

While we're at it, replace some inefficient uses of LoadConstantToReg(),
and remove the workaround that was added to allow conditional branches
to functions with external linkage.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/Library/ArmPlatformStackLib/AArch64/ArmPlatformStackLib.S
ArmPlatformPkg/Library/ArmPlatformStackLib/Arm/ArmPlatformStackLib.S

index 485017f62013987d020d6778787853a74354ba1b..65d7d6c6d686b88f63e7d752531dbdbbdd6d5d15 100644 (file)
 //\r
 \r
 #include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 3\r
-\r
-GCC_ASM_EXPORT(ArmPlatformStackSet)\r
-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
 \r
 //VOID\r
 //ArmPlatformStackSet (\r
@@ -35,7 +20,7 @@ GCC_ASM_IMPORT(gPcd_FixedAtBuild_PcdCoreCount)
 //  IN UINTN PrimaryStackSize,\r
 //  IN UINTN SecondaryStackSize\r
 //  );\r
-ASM_PFX(ArmPlatformStackSet):\r
+ASM_FUNC(ArmPlatformStackSet)\r
   // Save parameters\r
   mov   x6, x3\r
   mov   x5, x2\r
@@ -59,10 +44,10 @@ ASM_PFX(ArmPlatformStackSet):
   // Restore the Link register\r
   mov   x30, x7\r
 \r
-  // Should be ASM_PFX(ArmPlatformStackSetPrimary) but generate linker error 'unsupported ELF EM_AARCH64'\r
-  b.eq  ArmPlatformStackSetPrimaryL\r
-  // Should be ASM_PFX(ArmPlatformStackSetSecondary) but generate linker error 'unsupported ELF EM_AARCH64'\r
-  b.ne  ArmPlatformStackSetSecondaryL\r
+  b.ne  0f\r
+\r
+  b     ASM_PFX(ArmPlatformStackSetPrimary)\r
+0:b     ASM_PFX(ArmPlatformStackSetSecondary)\r
 \r
 //VOID\r
 //ArmPlatformStackSetPrimary (\r
@@ -71,8 +56,7 @@ ASM_PFX(ArmPlatformStackSet):
 //  IN UINTN PrimaryStackSize,\r
 //  IN UINTN SecondaryStackSize\r
 //  );\r
-ArmPlatformStackSetPrimaryL:\r
-ASM_PFX(ArmPlatformStackSetPrimary):\r
+ASM_FUNC(ArmPlatformStackSetPrimary)\r
   // Save the Link register\r
   mov   x4, x30\r
 \r
@@ -80,9 +64,7 @@ ASM_PFX(ArmPlatformStackSetPrimary):
   add   x0, x0, x2\r
 \r
   // Compute SecondaryCoresCount * SecondaryCoreStackSize\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, x1)\r
-  ldr   w1, [x1]\r
-  sub   x1, x1, #1\r
+  MOV32 (w1, FixedPcdGet32(PcdCoreCount) - 1)\r
   mul   x3, x3, x1\r
 \r
   // Set Primary Stack ((StackBase + PrimaryStackSize) + (SecondaryCoresCount * SecondaryCoreStackSize))\r
@@ -97,8 +79,7 @@ ASM_PFX(ArmPlatformStackSetPrimary):
 //  IN UINTN PrimaryStackSize,\r
 //  IN UINTN SecondaryStackSize\r
 //  );\r
-ArmPlatformStackSetSecondaryL:\r
-ASM_PFX(ArmPlatformStackSetSecondary):\r
+ASM_FUNC(ArmPlatformStackSetSecondary)\r
   // Save the Link register\r
   mov   x4, x30\r
   mov   sp, x0\r
index 96e925981fca45387b156a32119374087baff73b..bdd7a27b7cf9cc7b0e82dde35c5458ff364d761c 100644 (file)
 //\r
 \r
 #include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 3\r
-\r
-GCC_ASM_EXPORT(ArmPlatformStackSet)\r
-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
 \r
 //VOID\r
 //ArmPlatformStackSet (\r
@@ -35,7 +20,7 @@ GCC_ASM_IMPORT(gPcd_FixedAtBuild_PcdCoreCount)
 //  IN UINTN PrimaryStackSize,\r
 //  IN UINTN SecondaryStackSize\r
 //  );\r
-ASM_PFX(ArmPlatformStackSet):\r
+ASM_FUNC(ArmPlatformStackSet)\r
   // Save parameters\r
   mov   r6, r3\r
   mov   r5, r2\r
@@ -69,16 +54,14 @@ ASM_PFX(ArmPlatformStackSet):
 //  IN UINTN PrimaryStackSize,\r
 //  IN UINTN SecondaryStackSize\r
 //  );\r
-ASM_PFX(ArmPlatformStackSetPrimary):\r
+ASM_FUNC(ArmPlatformStackSetPrimary)\r
   mov   r4, lr\r
 \r
   // Add stack of primary stack to StackBase\r
   add   r0, r0, r2\r
 \r
   // Compute SecondaryCoresCount * SecondaryCoreStackSize\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, r1)\r
-  ldr   r1, [r1]\r
-  sub   r1, #1\r
+  MOV32 (r1, FixedPcdGet32(PcdCoreCount) - 1)\r
   mul   r3, r3, r1\r
 \r
   // Set Primary Stack ((StackBase + PrimaryStackSize) + (SecondaryCoresCount * SecondaryCoreStackSize))\r
@@ -93,7 +76,7 @@ ASM_PFX(ArmPlatformStackSetPrimary):
 //  IN UINTN PrimaryStackSize,\r
 //  IN UINTN SecondaryStackSize\r
 //  );\r
-ASM_PFX(ArmPlatformStackSetSecondary):\r
+ASM_FUNC(ArmPlatformStackSetSecondary)\r
   mov   r4, lr\r
   mov   sp, r0\r
 \r