]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg: clean up assembly source files
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 10 Aug 2016 11:08:57 +0000 (13:08 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 11 Aug 2016 10:29:31 +0000 (12:29 +0200)
This updates all assembly source files under ArmVirtPkg to mark
exported functions as ASM_FUNC(), which puts them in a separate
section, allowing the linker to prune code that is left unused.

At the same time, clean up the code to get rid of LoadConstantToReg()
instances involving symbol references, each of which emits an absolute
literal, and hence and entry in the PE/COFF .reloc table.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S
ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ARM/RelocatableVirtHelper.S
ArmVirtPkg/Library/ArmVirtPlatformLib/AARCH64/VirtHelper.S
ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.S
ArmVirtPkg/Library/ArmVirtPlatformLib/ARM/VirtHelper.asm
ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/AARCH64/RelocatableVirtHelper.S
ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ARM/RelocatableVirtHelper.S
ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
ArmVirtPkg/PrePi/Arm/ModuleEntryPoint.S

index 27ad07a1a1976bfb7fb98e0e617037bb0e9a084d..ec6955cf0af81165f4979fe67f8ee8cc6008adee 100644 (file)
@@ -1,5 +1,6 @@
 #\r
 #  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2016, Linaro 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
 \r
 #include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm64LinuxMagic:\r
-  .byte   0x41, 0x52, 0x4d, 0x64\r
 \r
 // VOID\r
 // ArmPlatformPeiBootAction (\r
 //   VOID   *DeviceTreeBaseAddress,   // passed by loader in x0\r
 //   VOID   *ImageBase                // passed by FDF trampoline in x1\r
 //   );\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
   //\r
   // If we are booting from RAM using the Linux kernel boot protocol, x0 will\r
   // point to the DTB image in memory. Otherwise, use the default value defined\r
@@ -104,20 +86,22 @@ ASM_PFX(ArmPlatformPeiBootAction):
 .Lout:\r
   ret    x29\r
 \r
+.LArm64LinuxMagic:\r
+  .byte   0x41, 0x52, 0x4d, 0x64\r
+\r
 //UINTN\r
 //ArmPlatformGetPrimaryCoreMpId (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)\r
-  ldrh   w0, [x0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+  MOV32  (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
   ret\r
 \r
 //UINTN\r
 //ArmPlatformIsPrimaryCore (\r
 //  IN UINTN MpId\r
 //  );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
   mov   x0, #1\r
   ret\r
 \r
@@ -126,7 +110,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId\r
 //  );\r
 // With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
   and   x1, x0, #ARM_CORE_MASK\r
   and   x0, x0, #ARM_CLUSTER_MASK\r
   add   x0, x1, x0, LSR #6\r
@@ -136,7 +120,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
 //GetPhysAddrTop (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
   mrs   x0, id_aa64mmfr0_el1\r
   adr   x1, .LPARanges\r
   and   x0, x0, #7\r
index 097038806ecd5578c0d28a1b5ca60d3c8dbf6c57..27af98970c1634de5b6475eb874f1b4d46002ef5 100644 (file)
@@ -1,6 +1,6 @@
 #\r
 #  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-#  Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+#  Copyright (c) 2014-2016, Linaro 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
 \r
 #include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
 \r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm32LinuxMagic:\r
-  .byte   0x18, 0x28, 0x6f, 0x01\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
   //\r
   // If we are booting from RAM using the Linux kernel boot protocol, r0 will\r
   // point to the DTB image in memory. Otherwise, use the default value defined\r
@@ -42,7 +23,7 @@ ASM_PFX(ArmPlatformPeiBootAction):
   //\r
   teq   r0, #0\r
   bne   0f\r
-  ldr   r0, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+  LDRL  (r0, PcdGet64 (PcdDeviceTreeInitialBaseAddress))\r
 \r
 0:mov   r11, r14            // preserve LR\r
   mov   r10, r0             // preserve DTB pointer\r
@@ -64,8 +45,8 @@ ASM_PFX(ArmPlatformPeiBootAction):
   // to the actual relocated value, and add the shift of PcdFdBaseAddress to\r
   // PcdFvBaseAddress as well\r
   //\r
-  ldr   r8, =PcdGet64 (PcdFdBaseAddress)\r
-  ldr   r7, =PcdGet64 (PcdFvBaseAddress)\r
+  ADRL  (r8, PcdGet64 (PcdFdBaseAddress))\r
+  ADRL  (r7, PcdGet64 (PcdFvBaseAddress))\r
   ldr   r6, [r8]\r
   ldr   r5, [r7]\r
   sub   r5, r5, r6\r
@@ -79,8 +60,8 @@ ASM_PFX(ArmPlatformPeiBootAction):
   // encountered. Since we are calling a C function, use the window at the\r
   // beginning of the FD image as a temp stack.\r
   //\r
-  ldr   r1, =PcdGet64 (PcdSystemMemoryBase)\r
-  ldr   r2, =PcdGet64 (PcdSystemMemorySize)\r
+  ADRL  (r1, PcdGet64 (PcdSystemMemoryBase))\r
+  ADRL  (r2, PcdGet64 (PcdSystemMemorySize))\r
   mov   sp, r5\r
   bl    FindMemnode\r
   teq   r0, #0\r
@@ -91,7 +72,7 @@ ASM_PFX(ArmPlatformPeiBootAction):
   // image header at the base of this image (defined in the FDF), and record the\r
   // pointer in PcdDeviceTreeInitialBaseAddress.\r
   //\r
-  ldr   r8, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+  ADRL  (r8, PcdGet64 (PcdDeviceTreeInitialBaseAddress))\r
   add   r9, r9, #0x40\r
   str   r9, [r8]\r
 \r
@@ -102,20 +83,22 @@ ASM_PFX(ArmPlatformPeiBootAction):
 .Lout:\r
   bx    r11\r
 \r
+.LArm32LinuxMagic:\r
+  .byte   0x18, 0x28, 0x6f, 0x01\r
+\r
 //UINTN\r
 //ArmPlatformGetPrimaryCoreMpId (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
-  ldr    r0, [r0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+  MOV32  (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
   bx     lr\r
 \r
 //UINTN\r
 //ArmPlatformIsPrimaryCore (\r
 //  IN UINTN MpId\r
 //  );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
   mov   r0, #1\r
   bx    lr\r
 \r
@@ -124,7 +107,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId\r
 //  );\r
 // With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
   and   r1, r0, #ARM_CORE_MASK\r
   and   r0, r0, #ARM_CLUSTER_MASK\r
   add   r0, r1, r0, LSR #6\r
@@ -134,8 +117,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
 //GetPhysAddrTop (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
   mov   r0, #0x00000000\r
   mov   r1, #0x10000\r
   bx    lr\r
-\r
index 14200fc17b3e473bf0db8d0535721791abf53bed..1d8fe25928d8c913f01e29a19bf25f0faeafd93d 100644 (file)
@@ -1,5 +1,6 @@
 #\r
 #  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2016, Linaro 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
 \r
 #include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
 \r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
   ret\r
 \r
 //UINTN\r
 //ArmPlatformGetPrimaryCoreMpId (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)\r
-  ldrh   w0, [x0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+  MOV32  (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
   ret\r
 \r
 //UINTN\r
 //ArmPlatformIsPrimaryCore (\r
 //  IN UINTN MpId\r
 //  );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
   mov   x0, #1\r
   ret\r
 \r
@@ -55,7 +39,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId\r
 //  );\r
 // With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
   and   x1, x0, #ARM_CORE_MASK\r
   and   x0, x0, #ARM_CLUSTER_MASK\r
   add   x0, x1, x0, LSR #6\r
@@ -65,7 +49,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
 //GetPhysAddrTop (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
   mrs   x0, id_aa64mmfr0_el1\r
   adr   x1, .LPARanges\r
   and   x0, x0, #7\r
index 255f99598740f564d3127949f0065a4c4dd769f5..4a4db372107292248d78305a8621e549066febec 100644 (file)
@@ -1,6 +1,6 @@
 #\r
 #  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-#  Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+#  Copyright (c) 2014-2016, Linaro 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
 \r
 #include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
 \r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
   bx    lr\r
 \r
 //UINTN\r
 //ArmPlatformGetPrimaryCoreMpId (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
-  ldr    r0, [r0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+  MOV32  (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
   bx     lr\r
 \r
 //UINTN\r
 //ArmPlatformIsPrimaryCore (\r
 //  IN UINTN MpId\r
 //  );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
   mov   r0, #1\r
   bx    lr\r
 \r
@@ -56,7 +39,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId\r
 //  );\r
 // With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
   and   r1, r0, #ARM_CORE_MASK\r
   and   r0, r0, #ARM_CLUSTER_MASK\r
   add   r0, r1, r0, LSR #6\r
@@ -66,7 +49,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
 //GetPhysAddrTop (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
   mov   r0, #0x00000000\r
   mov   r1, #0x10000\r
   bx    lr\r
index 7882e63217fcc54b99ddf96cfe8897482d3f8e24..b476516f21154fb5e5272c87e572004d2db4a1e6 100644 (file)
 //  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 //\r
 \r
-#include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
 #include <AutoGen.h>\r
 \r
   INCLUDE AsmMacroIoLib.inc\r
   EXPORT  ArmPlatformGetCorePosition\r
   EXPORT  ArmGetPhysAddrTop\r
 \r
-  IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCore\r
-  IMPORT  _gPcd_FixedAtBuild_PcdArmPrimaryCoreMask\r
-  IMPORT  _gPcd_FixedAtBuild_PcdCoreCount\r
-\r
   AREA VirtHelper, CODE, READONLY\r
 \r
 ArmPlatformPeiBootAction FUNCTION\r
@@ -40,8 +33,7 @@ ArmPlatformPeiBootAction FUNCTION
 //  VOID\r
 //  );\r
 ArmPlatformGetPrimaryCoreMpId FUNCTION\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
-  ldr    r0, [r0]\r
+  MOV32  r0, FixedPcdGet32 (PcdArmPrimaryCore)\r
   bx     lr\r
   ENDFUNC\r
 \r
index 940bcb2d257ade70409312e92a4e06fb30fa4df9..ce886378eae6a8115d3eca9816e3d632b5a23af5 100644 (file)
@@ -1,5 +1,6 @@
 #\r
 #  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2016, Linaro 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
 \r
 #include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm64LinuxMagic:\r
-  .byte   0x41, 0x52, 0x4d, 0x64\r
 \r
 // VOID\r
 // ArmPlatformPeiBootAction (\r
 //   VOID   *DeviceTreeBaseAddress,   // passed by loader in x0\r
 //   VOID   *ImageBase                // passed by FDF trampoline in x1\r
 //   );\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
   mov   x29, x30            // preserve LR\r
   mov   x28, x0             // preserve DTB pointer\r
   mov   x27, x1             // preserve base of image pointer\r
@@ -103,20 +85,22 @@ ASM_PFX(ArmPlatformPeiBootAction):
 .Lout:\r
   ret    x29\r
 \r
+.LArm64LinuxMagic:\r
+  .byte   0x41, 0x52, 0x4d, 0x64\r
+\r
 //UINTN\r
 //ArmPlatformGetPrimaryCoreMpId (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)\r
-  ldrh   w0, [x0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+  MOV32  (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
   ret\r
 \r
 //UINTN\r
 //ArmPlatformIsPrimaryCore (\r
 //  IN UINTN MpId\r
 //  );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
   mov   x0, #1\r
   ret\r
 \r
@@ -125,7 +109,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId\r
 //  );\r
 // With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
   and   x1, x0, #ARM_CORE_MASK\r
   and   x0, x0, #ARM_CLUSTER_MASK\r
   add   x0, x1, x0, LSR #6\r
@@ -135,7 +119,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
 //GetPhysAddrTop (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
   mrs   x0, id_aa64mmfr0_el1\r
   adr   x1, .LPARanges\r
   and   x0, x0, #7\r
index 539426f36f503f22b2a442637d4feddbf8ae81f6..f264fa1cf731fdf64c0668949e46aaac0dd1e6b4 100644 (file)
@@ -1,6 +1,6 @@
 #\r
 #  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-#  Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+#  Copyright (c) 2014-2016, Linaro 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
 \r
 #include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
 \r
-.text\r
-.align 2\r
-\r
-GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
-GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
-GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
-\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
-GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
-\r
-.LArm32LinuxMagic:\r
-  .byte   0x18, 0x28, 0x6f, 0x01\r
-\r
-ASM_PFX(ArmPlatformPeiBootAction):\r
+ASM_FUNC(ArmPlatformPeiBootAction)\r
   mov   r11, r14            // preserve LR\r
   mov   r10, r0             // preserve DTB pointer\r
   mov   r9, r1              // preserve base of image pointer\r
@@ -63,8 +44,8 @@ ASM_PFX(ArmPlatformPeiBootAction):
   // to the actual relocated value, and add the shift of PcdFdBaseAddress to\r
   // PcdFvBaseAddress as well\r
   //\r
-  ldr   r8, =PcdGet64 (PcdFdBaseAddress)\r
-  ldr   r7, =PcdGet64 (PcdFvBaseAddress)\r
+  ADRL  (r8, PcdGet64 (PcdFdBaseAddress))\r
+  ADRL  (r7, PcdGet64 (PcdFvBaseAddress))\r
   ldr   r6, [r8]\r
   ldr   r5, [r7]\r
   sub   r5, r5, r6\r
@@ -78,8 +59,8 @@ ASM_PFX(ArmPlatformPeiBootAction):
   // encountered. Since we are calling a C function, use the window at the\r
   // beginning of the FD image as a temp stack.\r
   //\r
-  ldr   r1, =PcdGet64 (PcdSystemMemoryBase)\r
-  ldr   r2, =PcdGet64 (PcdSystemMemorySize)\r
+  ADRL  (r1, PcdGet64 (PcdSystemMemoryBase))\r
+  ADRL  (r2, PcdGet64 (PcdSystemMemorySize))\r
   mov   sp, r5\r
   bl    FindMemnode\r
   teq   r0, #0\r
@@ -90,7 +71,7 @@ ASM_PFX(ArmPlatformPeiBootAction):
   // image header at the base of this image (defined in the FDF), and record the\r
   // pointer in PcdDeviceTreeInitialBaseAddress.\r
   //\r
-  ldr   r8, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+  ADRL  (r8, PcdGet64 (PcdDeviceTreeInitialBaseAddress))\r
   add   r9, r9, #0x40\r
   str   r9, [r8]\r
 \r
@@ -101,20 +82,22 @@ ASM_PFX(ArmPlatformPeiBootAction):
 .Lout:\r
   bx    r11\r
 \r
+.LArm32LinuxMagic:\r
+  .byte   0x18, 0x28, 0x6f, 0x01\r
+\r
 //UINTN\r
 //ArmPlatformGetPrimaryCoreMpId (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
-  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
-  ldr    r0, [r0]\r
+ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
+  MOV32  (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
   bx     lr\r
 \r
 //UINTN\r
 //ArmPlatformIsPrimaryCore (\r
 //  IN UINTN MpId\r
 //  );\r
-ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ASM_FUNC(ArmPlatformIsPrimaryCore)\r
   mov   r0, #1\r
   bx    lr\r
 \r
@@ -123,7 +106,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore):
 //  IN UINTN MpId\r
 //  );\r
 // With this function: CorePos = (ClusterId * 4) + CoreId\r
-ASM_PFX(ArmPlatformGetCorePosition):\r
+ASM_FUNC(ArmPlatformGetCorePosition)\r
   and   r1, r0, #ARM_CORE_MASK\r
   and   r0, r0, #ARM_CLUSTER_MASK\r
   add   r0, r1, r0, LSR #6\r
@@ -133,7 +116,7 @@ ASM_PFX(ArmPlatformGetCorePosition):
 //GetPhysAddrTop (\r
 //  VOID\r
 //  );\r
-ASM_PFX(ArmGetPhysAddrTop):\r
+ASM_FUNC(ArmGetPhysAddrTop)\r
   mov   r0, #0x00000000\r
   mov   r1, #0x10000\r
   bx    lr\r
index 1fed84ed0ac376b438a0fe73c3fa0f25e4a59e11..9c040b17f253b7f9ef4951c1bdb932b80102bb98 100644 (file)
@@ -1,6 +1,6 @@
 //\r
 //  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-//  Copyright (c) 2015, Linaro Limited. All rights reserved.\r
+//  Copyright (c) 2015-2016, Linaro 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
 \r
 #include <AsmMacroIoLibV8.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 3\r
-\r
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_IMPORT(ArmReadMpidr)\r
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_IMPORT(ArmPlatformStackSet)\r
-GCC_ASM_EXPORT(_ModuleEntryPoint)\r
-ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
 \r
-ASM_PFX(mSystemMemoryEnd):    .8byte 0\r
+ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
 \r
-ASM_PFX(_ModuleEntryPoint):\r
+ASM_FUNC(_ModuleEntryPoint)\r
   //\r
   // We are built as a ET_DYN PIE executable, so we need to process all\r
   // relative relocations regardless of whether or not we are executing from\r
@@ -86,12 +73,11 @@ _SetupStackPosition:
 \r
   // Calculate Top of the Firmware Device\r
   ldr   x2, PcdGet64 (PcdFdBaseAddress)\r
-  ldr   w3, PcdGet32 (PcdFdSize)\r
-  sub   x3, x3, #1\r
+  MOV32 (w3, FixedPcdGet32 (PcdFdSize) - 1)\r
   add   x3, x3, x2      // x3 = FdTop = PcdFdBaseAddress + PcdFdSize\r
 \r
   // UEFI Memory Size (stacks are allocated in this region)\r
-  LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), x4)\r
+  MOV32 (x4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize))\r
 \r
   //\r
   // Reserve the memory for the UEFI region (contain stacks on its top)\r
@@ -122,9 +108,7 @@ _SetupAlignedStack:
 _SetupOverflowStack:\r
   // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE\r
   // aligned (4KB)\r
-  LoadConstantToReg (EFI_PAGE_MASK, x21)\r
-  and   x21, x21, x1\r
-  sub   x1, x1, x21\r
+  and   x1, x1, ~EFI_PAGE_MASK\r
 \r
 _GetBaseUefiMemory:\r
   // Calculate the Base of the UEFI Memory\r
@@ -133,22 +117,19 @@ _GetBaseUefiMemory:
 _GetStackBase:\r
   // r1 = The top of the Mpcore Stacks\r
   // Stack for the primary core = PrimaryCoreStack\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)\r
+  MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
   sub   x22, x1, x2\r
 \r
   // Stack for the secondary core = Number of Cores - 1\r
-  LoadConstantToReg (FixedPcdGet32(PcdCoreCount), x0)\r
-  sub   x0, x0, #1\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x1)\r
-  mul   x1, x1, x0\r
+  MOV32 (x1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
   sub   x22, x22, x1\r
 \r
   // x22 = The base of the MpCore Stacks (primary stack & secondary stacks)\r
   mov   x0, x22\r
   mov   x1, x20\r
   //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), x2)\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), x3)\r
+  MOV32 (x2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
+  MOV32 (x3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
   bl    ASM_PFX(ArmPlatformStackSet)\r
 \r
   // Is it the Primary Core ?\r
@@ -170,3 +151,5 @@ _PrepareArguments:
 \r
 _NeverReturn:\r
   b _NeverReturn\r
+\r
+ASM_PFX(mSystemMemoryEnd):    .8byte 0\r
index a0176af91c8f02882f88d963accaf64e1f1d458f..e03aeefbb003283379ba1759100c8bbeb98de69d 100644 (file)
@@ -1,6 +1,6 @@
 //\r
 //  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-//  Copyright (c) 2015, Linaro Limited. All rights reserved.\r
+//  Copyright (c) 2015-2016, Linaro 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
 \r
 #include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
-\r
-.text\r
-.align 3\r
-\r
-GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore)\r
-GCC_ASM_IMPORT(ArmReadMpidr)\r
-GCC_ASM_IMPORT(ArmPlatformPeiBootAction)\r
-GCC_ASM_IMPORT(ArmPlatformStackSet)\r
-GCC_ASM_EXPORT(_ModuleEntryPoint)\r
-ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
-\r
-ASM_PFX(mSystemMemoryEnd):    .quad 0\r
 \r
-__relocs:\r
-  .long   __reloc_base - __relocs\r
-  .long   __reloc_start - __relocs\r
-  .long   __reloc_end - __relocs\r
+ASM_GLOBAL ASM_PFX(mSystemMemoryEnd)\r
 \r
-ASM_PFX(_ModuleEntryPoint):\r
+ASM_FUNC(_ModuleEntryPoint)\r
   //\r
   // We are built as a ET_DYN PIE executable, so we need to process all\r
   // relative relocations if we are executing from a different offset than we\r
   // were linked at. This is only possible if we are running from RAM.\r
   //\r
-\r
-  adr   r12, __relocs\r
-  ldrd  r4, r5, [r12]\r
-  ldr   r6, [r12, #8]\r
-\r
-  add   r4, r4, r12\r
-  add   r5, r5, r12\r
-  add   r6, r6, r12\r
+  ADRL  (r4, __reloc_base)\r
+  ADRL  (r5, __reloc_start)\r
+  ADRL  (r6, __reloc_end)\r
 \r
 .Lreloc_loop:\r
   cmp   r5, r6\r
@@ -85,9 +62,8 @@ ASM_PFX(_ModuleEntryPoint):
 // at the top of the DRAM)\r
 _SetupStackPosition:\r
   // Compute Top of System Memory\r
-  ldr   r12, =PcdGet64 (PcdSystemMemoryBase)\r
-  ldr   r1, [r12]\r
-  ldr   r12, =PcdGet64 (PcdSystemMemorySize)\r
+  LDRL  (r1, PcdGet64 (PcdSystemMemoryBase))\r
+  ADRL  (r12, PcdGet64 (PcdSystemMemorySize))\r
   ldrd  r2, r3, [r12]\r
 \r
   // calculate the top of memory, and record it in mSystemMemoryEnd\r
@@ -103,14 +79,12 @@ _SetupStackPosition:
   moveq r1, r2\r
 \r
   // Calculate Top of the Firmware Device\r
-  ldr   r12, =PcdGet64 (PcdFdBaseAddress)\r
-  ldr   r2, [r12]\r
-  ldr   r3, =FixedPcdGet32 (PcdFdSize)\r
-  sub   r3, r3, #1\r
+  LDRL  (r2, PcdGet64 (PcdFdBaseAddress))\r
+  MOV32 (r3, FixedPcdGet32 (PcdFdSize) - 1)\r
   add   r3, r3, r2      // r3 = FdTop = PcdFdBaseAddress + PcdFdSize\r
 \r
   // UEFI Memory Size (stacks are allocated in this region)\r
-  LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryUefiRegionSize), r4)\r
+  MOV32 (r4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize))\r
 \r
   //\r
   // Reserve the memory for the UEFI region (contain stacks on its top)\r
@@ -141,9 +115,8 @@ _SetupAlignedStack:
 _SetupOverflowStack:\r
   // Case memory at the top of the address space. Ensure the top of the stack is EFI_PAGE_SIZE\r
   // aligned (4KB)\r
-  LoadConstantToReg (EFI_PAGE_MASK, r11)\r
-  and   r11, r11, r1\r
-  sub   r1, r1, r11\r
+  MOV32 (r11, (~EFI_PAGE_MASK) & 0xffffffff)\r
+  and   r1, r1, r11\r
 \r
 _GetBaseUefiMemory:\r
   // Calculate the Base of the UEFI Memory\r
@@ -152,22 +125,19 @@ _GetBaseUefiMemory:
 _GetStackBase:\r
   // r1 = The top of the Mpcore Stacks\r
   // Stack for the primary core = PrimaryCoreStack\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
+  MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
   sub   r9, r1, r2\r
 \r
   // Stack for the secondary core = Number of Cores - 1\r
-  LoadConstantToReg (FixedPcdGet32(PcdCoreCount), r0)\r
-  sub   r0, r0, #1\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r1)\r
-  mul   r1, r1, r0\r
+  MOV32 (r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
   sub   r9, r9, r1\r
 \r
   // r9 = The base of the MpCore Stacks (primary stack & secondary stacks)\r
   mov   r0, r9\r
   mov   r1, r10\r
   //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize)\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCorePrimaryStackSize), r2)\r
-  LoadConstantToReg (FixedPcdGet32(PcdCPUCoreSecondaryStackSize), r3)\r
+  MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize))\r
+  MOV32 (r3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
   bl    ASM_PFX(ArmPlatformStackSet)\r
 \r
   // Is it the Primary Core ?\r
@@ -189,3 +159,5 @@ _PrepareArguments:
 \r
 _NeverReturn:\r
   b _NeverReturn\r
+\r
+ASM_PFX(mSystemMemoryEnd):    .quad 0\r