Revision: 16518
          http://sourceforge.net/p/edk2/code/16518
Author:   oliviermartin
Date:     2014-12-12 19:32:50 +0000 (Fri, 12 Dec 2014)
Log Message:
-----------
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 <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h
    trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc

Modified: trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h
===================================================================
--- trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h   2014-12-12 19:15:37 UTC (rev 
16517)
+++ trunk/edk2/ArmPkg/Include/AsmMacroIoLib.h   2014-12-12 19:32:50 UTC (rev 
16518)
@@ -149,7 +149,7 @@
 _InitializePrimaryStackLoop:          ;             \
   cmp     Tmp1, sp                    ;             \
   bls     _InitializePrimaryStackEnd  ;             \
-  str     GlobalSize, [Tmp1], #-4     ;             \
+  str     GlobalSize, [Tmp1, #-4]!    ;             \
   b       _InitializePrimaryStackLoop ;             \
 _InitializePrimaryStackEnd:
 
@@ -228,7 +228,7 @@
 _InitializePrimaryStackLoop:          ;             \
   cmp     Tmp1, sp                    ;             \
   bls     _InitializePrimaryStackEnd  ;             \
-  str     GlobalSize, [Tmp1], #-4     ;             \
+  str     GlobalSize, [Tmp1, #-4]!    ;             \
   b       _InitializePrimaryStackLoop ;             \
 _InitializePrimaryStackEnd:
 

Modified: trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc
===================================================================
--- trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc 2014-12-12 19:15:37 UTC (rev 
16517)
+++ trunk/edk2/ArmPkg/Include/AsmMacroIoLib.inc 2014-12-12 19:32:50 UTC (rev 
16518)
@@ -113,7 +113,7 @@
 _InitializePrimaryStackLoop
   cmp     $Tmp1, sp
   bls     _InitializePrimaryStackEnd
-  str     $GlobalSize, [$Tmp1], #-4
+  str     $GlobalSize, [$Tmp1, #-4]!
   b       _InitializePrimaryStackLoop
 _InitializePrimaryStackEnd
   MEND


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to