]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/PrePi/Arm/ModuleEntryPoint.asm
ArmPlatformPkg/PrePi: avoid global variable write to mSystemMemoryEnd
[mirror_edk2.git] / ArmPlatformPkg / PrePi / Arm / ModuleEntryPoint.asm
index 023339841f7529fedc6cdef465ad8261df03ec02..1e9daf563bb659af9e63fd39e799d3b78c8e0658 100644 (file)
   IMPORT  ArmReadMpidr\r
   IMPORT  ArmPlatformPeiBootAction\r
   IMPORT  ArmPlatformStackSet\r
+  IMPORT  mSystemMemoryEnd\r
 \r
   EXPORT  _ModuleEntryPoint\r
-  EXPORT  mSystemMemoryEnd\r
 \r
   PRESERVE8\r
   AREA    PrePiCoreEntryPoint, CODE, READONLY\r
 \r
 StartupAddr        DCD      CEntryPoint\r
-mSystemMemoryEnd   DCQ      0\r
 \r
 _ModuleEntryPoint\r
   // Do early platform specific actions\r
@@ -49,19 +48,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)\r
-  mov32 r2, FixedPcdGet32(PcdSystemMemorySize)\r
-  sub   r2, r2, #1\r
-  add   r1, r1, r2\r
-  // Update the global variable\r
-  adr   r2, mSystemMemoryEnd\r
-  str   r1, [r2]\r
+  mov32 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