]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.S
ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd
[mirror_edk2.git] / ArmPlatformPkg / PrePi / Arm / ModuleEntryPoint.S
index 39030da5f2c3d2be26dc7fe1f0f70df1f7df7d0a..212cab62d44b28de71a420057f7fe67b6806ef3d 100644 (file)
@@ -15,8 +15,6 @@
 \r
 #include <Chipset/ArmV7.h>\r
 \r
-GCC_ASM_EXPORT(mSystemMemoryEnd)\r
-\r
 ASM_FUNC(_ModuleEntryPoint)\r
   // Do early platform specific actions\r
   bl    ASM_PFX(ArmPlatformPeiBootAction)\r
@@ -35,17 +33,11 @@ _SetSVCMode:
 // to install the stacks at the bottom of the Firmware Device (case the FD is located\r
 // at the top of the DRAM)\r
 _SystemMemoryEndInit:\r
-  ldr   r1, mSystemMemoryEnd\r
-\r
-  // Is mSystemMemoryEnd initialized?\r
-  cmp   r1, #0\r
-  bne   _SetupStackPosition\r
-\r
-  MOV32 (r1, FixedPcdGet32(PcdSystemMemoryBase) + FixedPcdGet32(PcdSystemMemorySize) - 1)\r
-\r
-  // Update the global variable\r
-  adr   r2, mSystemMemoryEnd\r
-  str   r1, [r2]\r
+  ADRL  (r1, mSystemMemoryEnd)\r
+  ldrd  r2, r3, [r1]\r
+  teq   r3, #0\r
+  moveq r1, r2\r
+  mvnne r1, #0\r
 \r
 _SetupStackPosition:\r
   // r1 = SystemMemoryTop\r
@@ -136,5 +128,3 @@ _PrepareArguments:
 \r
 _NeverReturn:\r
   b _NeverReturn\r
-\r
-ASM_PFX(mSystemMemoryEnd):  .8byte 0\r