summaryrefslogtreecommitdiff
path: root/ArmPkg/Include
diff options
context:
space:
mode:
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-28 17:23:53 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-28 17:23:53 +0000
commit1377db63ff80bbb28da572c7b276ba56faea5f94 (patch)
tree40938c5d1960667bed42eb0e87da13a120fc8420 /ArmPkg/Include
parent2569b068685b126c64753c280f339e1e6869d068 (diff)
downloadedk2-platforms-1377db63ff80bbb28da572c7b276ba56faea5f94.tar.xz
ArmPlatformPkg: Updated the stack setup to have the same geometry between the Secure and Normal World
Having a similar setup reduces the error during the MPCore stack setup. The stack setup is described on this wikipage: https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=ArmPlatformPkg/Stack git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13058 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Include')
-rw-r--r--ArmPkg/Include/AsmMacroIoLib.h23
-rw-r--r--ArmPkg/Include/AsmMacroIoLib.inc14
2 files changed, 35 insertions, 2 deletions
diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h
index 644c654665..a4ae22dca0 100644
--- a/ArmPkg/Include/AsmMacroIoLib.h
+++ b/ArmPkg/Include/AsmMacroIoLib.h
@@ -2,6 +2,7 @@
Macros to work around lack of Apple support for LDR register, =expr
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+ Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -132,7 +133,16 @@
and Tmp, GlobalSize, #7 ; \
rsbne Tmp, Tmp, #8 ; \
add GlobalSize, GlobalSize, Tmp ; \
- sub sp, StackTop, GlobalSize
+ sub sp, StackTop, GlobalSize ; \
+ ; \
+ mov Tmp, sp ; \
+ mov GlobalSize, #0x0 ; \
+_SetPrimaryStackInitGlobals: ; \
+ cmp Tmp, StackTop ; \
+ beq _SetPrimaryStackEnd ; \
+ str GlobalSize, [Tmp], #4 ; \
+ b _SetPrimaryStackInitGlobals ; \
+_SetPrimaryStackEnd:
#elif defined (__GNUC__)
@@ -192,7 +202,16 @@
and Tmp, GlobalSize, #7 ; \
rsbne Tmp, Tmp, #8 ; \
add GlobalSize, GlobalSize, Tmp ; \
- sub sp, StackTop, GlobalSize
+ sub sp, StackTop, GlobalSize ; \
+ ; \
+ mov Tmp, sp ; \
+ mov GlobalSize, #0x0 ; \
+_SetPrimaryStackInitGlobals: ; \
+ cmp Tmp, StackTop ; \
+ beq _SetPrimaryStackEnd ; \
+ str GlobalSize, [Tmp], #4 ; \
+ b _SetPrimaryStackInitGlobals ; \
+_SetPrimaryStackEnd:
#else
diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
index 5644bf9b30..a847579a37 100644
--- a/ArmPkg/Include/AsmMacroIoLib.inc
+++ b/ArmPkg/Include/AsmMacroIoLib.inc
@@ -3,6 +3,8 @@
; Macros to work around lack of Apple support for LDR register, =expr
;
; Copyright (c) 2009, Apple Inc. All rights reserved.<BR>
+; Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
+;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
@@ -86,12 +88,24 @@
MEND
; The reserved place must be 8-bytes aligned for pushing 64-bit variable on the stack
+ ; Note: Global Size will be modified
MACRO
SetPrimaryStack $StackTop, $GlobalSize, $Tmp
and $Tmp, $GlobalSize, #7
rsbne $Tmp, $Tmp, #8
add $GlobalSize, $GlobalSize, $Tmp
sub sp, $StackTop, $GlobalSize
+
+ ; Set all the global variables to 0
+ mov $Tmp, sp
+ mov $GlobalSize, #0x0
+_SetPrimaryStackInitGlobals
+ cmp $Tmp, $StackTop
+ beq _SetPrimaryStackEnd
+ str $GlobalSize, [$Tmp], #4
+ b _SetPrimaryStackInitGlobals
+
+_SetPrimaryStackEnd
MEND
END