]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/AsmMacroIoLib: Fixed the global variables initialization
authorOlivier Martin <olivier.martin@arm.com>
Fri, 12 Dec 2014 19:32:50 +0000 (19:32 +0000)
committeroliviermartin <oliviermartin@Edk2>
Fri, 12 Dec 2014 19:32:50 +0000 (19:32 +0000)
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

ArmPkg/Include/AsmMacroIoLib.h
ArmPkg/Include/AsmMacroIoLib.inc

index 408b2ca28074fb46803ed9b53802297dc768164f..6904bdc9b001b030d892607a243737d10fd35237 100644 (file)
@@ -149,7 +149,7 @@ _SetPrimaryStackEnd:
 _InitializePrimaryStackLoop:          ;             \\r
   cmp     Tmp1, sp                    ;             \\r
   bls     _InitializePrimaryStackEnd  ;             \\r
-  str     GlobalSize, [Tmp1], #-4     ;             \\r
+  str     GlobalSize, [Tmp1, #-4]!    ;             \\r
   b       _InitializePrimaryStackLoop ;             \\r
 _InitializePrimaryStackEnd:\r
 \r
@@ -228,7 +228,7 @@ _SetPrimaryStackEnd:
 _InitializePrimaryStackLoop:          ;             \\r
   cmp     Tmp1, sp                    ;             \\r
   bls     _InitializePrimaryStackEnd  ;             \\r
-  str     GlobalSize, [Tmp1], #-4     ;             \\r
+  str     GlobalSize, [Tmp1, #-4]!    ;             \\r
   b       _InitializePrimaryStackLoop ;             \\r
 _InitializePrimaryStackEnd:\r
 \r
index 87e497b31ad9cd32e8db2e78d6f14177fbc23e0c..301bd890ac4d6ca93a20e09a56893a8d21c7f44b 100644 (file)
@@ -113,7 +113,7 @@ _SetPrimaryStackEnd
 _InitializePrimaryStackLoop\r
   cmp     $Tmp1, sp\r
   bls     _InitializePrimaryStackEnd\r
-  str     $GlobalSize, [$Tmp1], #-4\r
+  str     $GlobalSize, [$Tmp1, #-4]!\r
   b       _InitializePrimaryStackLoop\r
 _InitializePrimaryStackEnd\r
   MEND\r