]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S
ArmPlatformPkg/PrePi: switch to ASM_FUNC() asm macro
[mirror_edk2.git] / ArmPlatformPkg / PrePi / Arm / ModuleEntryPoint.S
index 1311efc5cb2cabd40129671b6865c0c84244aeb4..b7127ce9fb4c7112a36a3f9292ee40b7799f5126 100644 (file)
 //\r
 \r
 #include <AsmMacroIoLib.h>\r
-#include <Base.h>\r
-#include <Library/PcdLib.h>\r
-#include <AutoGen.h>\r
 \r
 #include <Chipset/ArmV7.h>\r
 \r
-.text\r
-.align 3\r
-\r
-GCC_ASM_IMPORT(CEntryPoint)\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
 GCC_ASM_EXPORT(mSystemMemoryEnd)\r
 \r
-StartupAddr:       .word  CEntryPoint\r
-mSystemMemoryEnd:  .8byte 0\r
-\r
-\r
-ASM_PFX(_ModuleEntryPoint):\r
+ASM_FUNC(_ModuleEntryPoint)\r
   // Do early platform specific actions\r
   bl    ASM_PFX(ArmPlatformPeiBootAction)\r
 \r
@@ -57,10 +41,8 @@ _SystemMemoryEndInit:
   cmp   r1, #0\r
   bne   _SetupStackPosition\r
 \r
-  LoadConstantToReg (FixedPcdGet32(PcdSystemMemoryBase), r1)\r
-  LoadConstantToReg (FixedPcdGet32(PcdSystemMemorySize), r2)\r
-  sub   r2, r2, #1\r
-  add   r1, r1, r2\r
+  MOV32 (r1, FixedPcdGet32(PcdSystemMemoryBase) + FixedPcdGet32(PcdSystemMemorySize) - 1)\r
+\r
   // Update the global variable\r
   adr   r2, mSystemMemoryEnd\r
   str   r1, [r2]\r
@@ -69,13 +51,12 @@ _SetupStackPosition:
   // r1 = SystemMemoryTop\r
 \r
   // Calculate Top of the Firmware Device\r
-  LoadConstantToReg (FixedPcdGet32(PcdFdBaseAddress), r2)\r
-  LoadConstantToReg (FixedPcdGet32(PcdFdSize), r3)\r
-  sub   r3, r3, #1\r
+  MOV32 (r2, FixedPcdGet32(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
@@ -106,9 +87,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, r9)\r
-  and   r9, r9, r1\r
-  sub   r1, r1, r9\r
+  MOV32 (r9, ~EFI_PAGE_MASK & 0xFFFFFFFF)\r
+  and   r1, r1, r9\r
 \r
 _GetBaseUefiMemory:\r
   // Calculate the Base of the UEFI Memory\r
@@ -117,22 +97,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   r10, 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 (r0, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize))\r
   sub   r10, r10, r1\r
 \r
   // r10 = The base of the MpCore Stacks (primary stack & secondary stacks)\r
   mov   r0, r10\r
   mov   r1, r8\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
@@ -149,7 +126,7 @@ _PrepareArguments:
 \r
   // Move sec startup address into a data register\r
   // Ensure we're jumping to FV version of the code (not boot remapped alias)\r
-  ldr   r4, StartupAddr\r
+  ldr   r4, =ASM_PFX(CEntryPoint)\r
 \r
   // Jump to PrePiCore C code\r
   //    r0 = MpId\r
@@ -160,3 +137,4 @@ _PrepareArguments:
 _NeverReturn:\r
   b _NeverReturn\r
 \r
+ASM_PFX(mSystemMemoryEnd):  .8byte 0\r