]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S
ArmVirtPkg: clean up assembly source files
[mirror_edk2.git] / ArmVirtPkg / PrePi / AArch64 / ModuleEntryPoint.S
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