ArmPkg/AsmMacroIoLib: Fixed the global variables initialization

The top of the stack always points to 'stack_base + stack_size'.
But the stack pointer is decremented before writing to the stack.
It means the top byte of the stack is actually 'stack_base + stack_size - 1'.

The initialization should also decrement the stack pointer before
zero'ing the memory (pre-indexed addressing).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16518 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2014-12-12 19:32:50 +00:00 committed by oliviermartin
parent 85774874bc
commit d5daaa836f
2 changed files with 3 additions and 3 deletions

View File

@ -149,7 +149,7 @@ _SetPrimaryStackEnd:
_InitializePrimaryStackLoop: ; \ _InitializePrimaryStackLoop: ; \
cmp Tmp1, sp ; \ cmp Tmp1, sp ; \
bls _InitializePrimaryStackEnd ; \ bls _InitializePrimaryStackEnd ; \
str GlobalSize, [Tmp1], #-4 ; \ str GlobalSize, [Tmp1, #-4]! ; \
b _InitializePrimaryStackLoop ; \ b _InitializePrimaryStackLoop ; \
_InitializePrimaryStackEnd: _InitializePrimaryStackEnd:
@ -228,7 +228,7 @@ _SetPrimaryStackEnd:
_InitializePrimaryStackLoop: ; \ _InitializePrimaryStackLoop: ; \
cmp Tmp1, sp ; \ cmp Tmp1, sp ; \
bls _InitializePrimaryStackEnd ; \ bls _InitializePrimaryStackEnd ; \
str GlobalSize, [Tmp1], #-4 ; \ str GlobalSize, [Tmp1, #-4]! ; \
b _InitializePrimaryStackLoop ; \ b _InitializePrimaryStackLoop ; \
_InitializePrimaryStackEnd: _InitializePrimaryStackEnd:

View File

@ -113,7 +113,7 @@ _SetPrimaryStackEnd
_InitializePrimaryStackLoop _InitializePrimaryStackLoop
cmp $Tmp1, sp cmp $Tmp1, sp
bls _InitializePrimaryStackEnd bls _InitializePrimaryStackEnd
str $GlobalSize, [$Tmp1], #-4 str $GlobalSize, [$Tmp1, #-4]!
b _InitializePrimaryStackLoop b _InitializePrimaryStackLoop
_InitializePrimaryStackEnd _InitializePrimaryStackEnd
MEND MEND