summaryrefslogtreecommitdiff
path: root/ArmPkg/Include/AsmMacroIoLib.h
diff options
context:
space:
mode:
Diffstat (limited to 'ArmPkg/Include/AsmMacroIoLib.h')
-rw-r--r--ArmPkg/Include/AsmMacroIoLib.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h
index 0276275a41..c8692fcfd7 100644
--- a/ArmPkg/Include/AsmMacroIoLib.h
+++ b/ArmPkg/Include/AsmMacroIoLib.h
@@ -144,6 +144,21 @@ _SetPrimaryStackInitGlobals: ; \
b _SetPrimaryStackInitGlobals ; \
_SetPrimaryStackEnd:
+// Initialize the Global Variable with '0'
+#define InitializePrimaryStack(GlobalSize, Tmp1) \
+ and Tmp1, GlobalSize, #7 ; \
+ rsbne Tmp1, Tmp1, #8 ; \
+ add GlobalSize, GlobalSize, Tmp1 ; \
+ ; \
+ mov Tmp1, sp ; \
+ sub sp, GlobalSize ; \
+ mov GlobalSize, #0x0 ; \
+_InitializePrimaryStackLoop: ; \
+ cmp Tmp1, sp ; \
+ bls _InitializePrimaryStackEnd ; \
+ str GlobalSize, [Tmp1], #-4 ; \
+ b _InitializePrimaryStackLoop ; \
+_InitializePrimaryStackEnd:
#elif defined (__GNUC__)
@@ -213,6 +228,22 @@ _SetPrimaryStackInitGlobals: ; \
b _SetPrimaryStackInitGlobals ; \
_SetPrimaryStackEnd:
+// Initialize the Global Variable with '0'
+#define InitializePrimaryStack(GlobalSize, Tmp1) \
+ and Tmp1, GlobalSize, #7 ; \
+ rsbne Tmp1, Tmp1, #8 ; \
+ add GlobalSize, GlobalSize, Tmp1 ; \
+ ; \
+ mov Tmp1, sp ; \
+ sub sp, GlobalSize ; \
+ mov GlobalSize, #0x0 ; \
+_InitializePrimaryStackLoop: ; \
+ cmp Tmp1, sp ; \
+ bls _InitializePrimaryStackEnd ; \
+ str GlobalSize, [Tmp1], #-4 ; \
+ b _InitializePrimaryStackLoop ; \
+_InitializePrimaryStackEnd:
+
#else
//
@@ -278,6 +309,9 @@ _SetPrimaryStackEnd:
#define SetPrimaryStack(StackTop,GlobalSize,Tmp) SetPrimaryStack StackTop, GlobalSize, Tmp
+// Initialize the Global Variable with '0'
+#define InitializePrimaryStack(GlobalSize, Tmp1) InitializePrimaryStack GlobalSize, Tmp1
+
#endif
#endif