]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Include/AsmMacroIoLib.h
ARM Packages: Removed trailing spaces
[mirror_edk2.git] / ArmPkg / Include / AsmMacroIoLib.h
index 0276275a41f09e8318c711d7fccd080333f2ab83..408b2ca28074fb46803ed9b53802297dc768164f 100644 (file)
   .long (_Data)           ;                 \\r
 1:\r
 \r
-// Convert the (ClusterId,CoreId) into a Core Position\r
-// We assume there are 4 cores per cluster\r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp) \\r
-  lsr   Pos, MpId, #6 ;                        \\r
-  and   Tmp, MpId, #3 ;                        \\r
-  add   Pos, Pos, Tmp\r
-\r
 // Reserve a region at the top of the Primary Core stack\r
 // for Global variables for the XIP phase\r
 #define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \\r
@@ -144,6 +137,21 @@ _SetPrimaryStackInitGlobals:          ;             \
   b       _SetPrimaryStackInitGlobals ;             \\r
 _SetPrimaryStackEnd:\r
 \r
+// Initialize the Global Variable with '0'\r
+#define 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
+  mov     GlobalSize, #0x0            ;             \\r
+_InitializePrimaryStackLoop:          ;             \\r
+  cmp     Tmp1, sp                    ;             \\r
+  bls     _InitializePrimaryStackEnd  ;             \\r
+  str     GlobalSize, [Tmp1], #-4     ;             \\r
+  b       _InitializePrimaryStackLoop ;             \\r
+_InitializePrimaryStackEnd:\r
 \r
 #elif defined (__GNUC__)\r
 \r
@@ -151,7 +159,7 @@ _SetPrimaryStackEnd:
   ldr  r1, =Address ;              \\r
   ldr  r0, =Data    ;              \\r
   str  r0, [r1]\r
-    \r
+\r
 #define MmioOr32(Address, OrData) \\r
   ldr  r1, =Address ;             \\r
   ldr  r2, =OrData  ;             \\r
@@ -173,7 +181,7 @@ _SetPrimaryStackEnd:
   and  r0, r0, r2   ;                             \\r
   ldr  r2, =OrData  ;                             \\r
   orr  r0, r0, r2   ;                             \\r
-  str  r0, [r1]         \r
+  str  r0, [r1]\r
 \r
 #define MmioWriteFromReg32(Address, Reg) \\r
   ldr  r1, =Address ;                    \\r
@@ -192,11 +200,6 @@ _SetPrimaryStackEnd:
 \r
 #define LoadConstantToReg(Data, Reg) \\r
   ldr  Reg, =Data\r
-  \r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp) \\r
-  lsr   Pos, MpId, #6 ;                        \\r
-  and   Tmp, MpId, #3 ;                        \\r
-  add   Pos, Pos, Tmp\r
 \r
 #define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \\r
   and     Tmp, GlobalSize, #7         ;             \\r
@@ -213,10 +216,26 @@ _SetPrimaryStackInitGlobals:          ;             \
   b       _SetPrimaryStackInitGlobals ;             \\r
 _SetPrimaryStackEnd:\r
 \r
+// Initialize the Global Variable with '0'\r
+#define 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
+  mov     GlobalSize, #0x0            ;             \\r
+_InitializePrimaryStackLoop:          ;             \\r
+  cmp     Tmp1, sp                    ;             \\r
+  bls     _InitializePrimaryStackEnd  ;             \\r
+  str     GlobalSize, [Tmp1], #-4     ;             \\r
+  b       _InitializePrimaryStackLoop ;             \\r
+_InitializePrimaryStackEnd:\r
+\r
 #else\r
 \r
 //\r
-// Use ARM assembly macros, form armasam \r
+// Use ARM assembly macros, form armasam\r
 //\r
 //  Less magic in the macros if ldr reg, =expr works\r
 //\r
@@ -232,7 +251,7 @@ _SetPrimaryStackEnd:
 \r
 // returns Data in R0 and Address in R1, and OrData in r2\r
 #define MmioOr32(Address, OrData) MmioOr32Macro Address, OrData\r
-  \r
+\r
 \r
 // returns _Data in R0 and _Address in R1, and _OrData in r2\r
 \r
@@ -274,10 +293,11 @@ _SetPrimaryStackEnd:
 // conditional load testing eq flag\r
 #define LoadConstantToRegIfEq(Data, Reg)  LoadConstantToRegIfEqMacro Data, Reg\r
 \r
-#define GetCorePositionFromMpId(Pos, MpId, Tmp)  GetCorePositionFromMpId Pos, MpId, Tmp\r
-\r
 #define SetPrimaryStack(StackTop,GlobalSize,Tmp) SetPrimaryStack StackTop, GlobalSize, Tmp\r
 \r
+// Initialize the Global Variable with '0'\r
+#define InitializePrimaryStack(GlobalSize, Tmp1) InitializePrimaryStack GlobalSize, Tmp1\r
+\r
 #endif\r
 \r
 #endif\r