summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-28 11:01:36 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-09-28 11:01:36 +0000
commit17839a45b8748b88048774e2daefba4d0331678e (patch)
treec5d49d910ca2c9127060c048907ea4a648e88134 /ArmPkg
parent7d49ced0cf64fbb3abf6b4d97dac4806bd1d9ee6 (diff)
downloadedk2-17839a45b8748b88048774e2daefba4d0331678e.zip
edk2-17839a45b8748b88048774e2daefba4d0331678e.tar.gz
edk2-17839a45b8748b88048774e2daefba4d0331678e.tar.bz2
ArmPlatformPkg/ArmPlatformStackLib: Introduced helper library to initialize stacks
The new functions are: - ArmPlatformStackSet(IN UINTN StackBase, IN UINTN MpId, IN UINTN PrimaryStackSize, IN UINTN SecondaryStackSize); - ArmPlatformStackSetPrimary(IN UINTN StackBase, IN UINTN MpId, IN UINTN PrimaryStackSize, IN UINTN SecondaryStackSize); - ArmPlatformStackSetSecondary(IN UINTN StackBase, IN UINTN MpId, IN UINTN PrimaryStackSize, IN UINTN SecondaryStackSize); The stack topology can be changed by implementing a new ArmPlatformStackLib Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13774 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Include/AsmMacroIoLib.h34
-rw-r--r--ArmPkg/Include/AsmMacroIoLib.inc19
2 files changed, 52 insertions, 1 deletions
diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h
index 0276275..c8692fc 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
diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
index 5ed9e05..1ca99fd 100644
--- a/ArmPkg/Include/AsmMacroIoLib.inc
+++ b/ArmPkg/Include/AsmMacroIoLib.inc
@@ -104,8 +104,25 @@ _SetPrimaryStackInitGlobals
beq _SetPrimaryStackEnd
str $GlobalSize, [$Tmp], #4
b _SetPrimaryStackInitGlobals
-
_SetPrimaryStackEnd
MEND
+ MACRO
+ InitializePrimaryStack $GlobalSize, $Tmp1
+ and $Tmp1, $GlobalSize, #7
+ rsbne $Tmp1, $Tmp1, #8
+ add $GlobalSize, $GlobalSize, $Tmp1
+
+ mov $Tmp1, sp
+ sub sp, $GlobalSize
+ ; Set all the global variables to 0
+ mov $GlobalSize, #0x0
+_InitializePrimaryStackLoop
+ cmp $Tmp1, sp
+ bls _InitializePrimaryStackEnd
+ str $GlobalSize, [$Tmp1], #-4
+ b _InitializePrimaryStackLoop
+_InitializePrimaryStackEnd
+ MEND
+
END