X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ArmPkg%2FInclude%2FAsmMacroIoLib.h;h=dac2e150cc88bc468ab3a560abfa10f9b6769ae2;hb=e700a1fc9158cd8f956bd9d2a1867f47ee6591cc;hp=1ea2c33ffb6fda82999ce052aa37f6c446df997a;hpb=d6ebcab76903254f4423b7e7d3808fb0abaadb46;p=mirror_edk2.git diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h index 1ea2c33ffb..dac2e150cc 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.
+ Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -119,6 +120,38 @@ .long (_Data) ; \ 1: +// Reserve a region at the top of the Primary Core stack +// for Global variables for the XIP phase +#define SetPrimaryStack(StackTop, GlobalSize, Tmp) \ + and Tmp, GlobalSize, #7 ; \ + rsbne Tmp, Tmp, #8 ; \ + add GlobalSize, GlobalSize, Tmp ; \ + sub sp, StackTop, GlobalSize ; \ + ; \ + mov Tmp, sp ; \ + mov GlobalSize, #0x0 ; \ +_SetPrimaryStackInitGlobals: ; \ + cmp Tmp, StackTop ; \ + beq _SetPrimaryStackEnd ; \ + str GlobalSize, [Tmp], #4 ; \ + 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__) @@ -167,7 +200,38 @@ #define LoadConstantToReg(Data, Reg) \ ldr Reg, =Data - + +#define SetPrimaryStack(StackTop, GlobalSize, Tmp) \ + and Tmp, GlobalSize, #7 ; \ + rsbne Tmp, Tmp, #8 ; \ + add GlobalSize, GlobalSize, Tmp ; \ + sub sp, StackTop, GlobalSize ; \ + ; \ + mov Tmp, sp ; \ + mov GlobalSize, #0x0 ; \ +_SetPrimaryStackInitGlobals: ; \ + cmp Tmp, StackTop ; \ + beq _SetPrimaryStackEnd ; \ + str GlobalSize, [Tmp], #4 ; \ + 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 // @@ -229,8 +293,11 @@ // conditional load testing eq flag #define LoadConstantToRegIfEq(Data, Reg) LoadConstantToRegIfEqMacro Data, Reg +#define SetPrimaryStack(StackTop,GlobalSize,Tmp) SetPrimaryStack StackTop, GlobalSize, Tmp -#endif +// Initialize the Global Variable with '0' +#define InitializePrimaryStack(GlobalSize, Tmp1) InitializePrimaryStack GlobalSize, Tmp1 +#endif #endif