]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Include/AsmMacroIoLib.inc
ARM Packages: Replaced the macro GetCorePositionFromMpId() by the ArmPlatformGetCoreP...
[mirror_edk2.git] / ArmPkg / Include / AsmMacroIoLib.inc
index 5644bf9b3076f02ae16fd4ddb7ccd8bcd1d3f36d..54c32d4c34f949fb6cd4013bcf5325327cbfa239 100644 (file)
@@ -3,6 +3,8 @@
 ;  Macros to work around lack of Apple support for LDR register, =expr\r
 ;\r
 ;  Copyright (c) 2009, Apple Inc. All rights reserved.<BR>\r
+;  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+;\r
 ;  This program and the accompanying materials                          \r
 ;  are licensed and made available under the terms and conditions of the BSD License         \r
 ;  which accompanies this distribution.  The full text of the license may be found at        \r
   ldr  $Reg, =($Data) \r
   MEND \r
   \r
-  MACRO\r
-  GetCorePositionInStack $Pos, $MpId, $Tmp\r
-  lsr   $Pos, $MpId, #6\r
-  and   $Tmp, $MpId, #3\r
-  add   $Pos, $Pos, $Tmp\r
-  MEND\r
-  \r
   ; The reserved place must be 8-bytes aligned for pushing 64-bit variable on the stack\r
+  ; Note: Global Size will be modified\r
   MACRO\r
   SetPrimaryStack $StackTop, $GlobalSize, $Tmp\r
   and     $Tmp, $GlobalSize, #7\r
   rsbne   $Tmp, $Tmp, #8\r
   add     $GlobalSize, $GlobalSize, $Tmp\r
   sub     sp, $StackTop, $GlobalSize\r
+\r
+  ; Set all the global variables to 0\r
+  mov     $Tmp, sp\r
+  mov     $GlobalSize, #0x0\r
+_SetPrimaryStackInitGlobals\r
+  cmp     $Tmp, $StackTop\r
+  beq     _SetPrimaryStackEnd\r
+  str     $GlobalSize, [$Tmp], #4\r
+  b       _SetPrimaryStackInitGlobals\r
+_SetPrimaryStackEnd\r
+  MEND\r
+\r
+  MACRO\r
+  InitializePrimaryStack $GlobalSize, $Tmp1\r
+  and     $Tmp1, $GlobalSize, #7\r
+  rsbne   $Tmp1, $Tmp1, #8\r
+  add     $GlobalSize, $GlobalSize, $Tmp1\r
+\r
+  mov     $Tmp1, sp\r
+  sub     sp, $GlobalSize\r
+  ; Set all the global variables to 0\r
+  mov     $GlobalSize, #0x0\r
+_InitializePrimaryStackLoop\r
+  cmp     $Tmp1, sp\r
+  bls     _InitializePrimaryStackEnd\r
+  str     $GlobalSize, [$Tmp1], #-4\r
+  b       _InitializePrimaryStackLoop\r
+_InitializePrimaryStackEnd\r
   MEND\r
 \r
   END\r