diff options
Diffstat (limited to 'ArmPkg')
-rw-r--r-- | ArmPkg/Include/AsmMacroIoLib.h | 15 | ||||
-rw-r--r-- | ArmPkg/Include/AsmMacroIoLib.inc | 16 |
2 files changed, 30 insertions, 1 deletions
diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h index 1ea2c33ffb..9ef3430aaa 100644 --- a/ArmPkg/Include/AsmMacroIoLib.h +++ b/ArmPkg/Include/AsmMacroIoLib.h @@ -168,6 +168,17 @@ #define LoadConstantToReg(Data, Reg) \
ldr Reg, =Data
+#define GetCorePositionInStack(Pos, MpId, Tmp) \
+ lsr Pos, MpId, #6 ; \
+ and Tmp, MpId, #3 ; \
+ add Pos, Pos, Tmp
+
+#define SetPrimaryStack(StackTop, GlobalSize, Tmp) \
+ and Tmp, GlobalSize, #7 ; \
+ rsbne Tmp, Tmp, #8 ; \
+ add GlobalSize, GlobalSize, Tmp ; \
+ sub sp, StackTop, GlobalSize
+
#else
//
@@ -229,8 +240,10 @@ // conditional load testing eq flag
#define LoadConstantToRegIfEq(Data, Reg) LoadConstantToRegIfEqMacro Data, Reg
+#define GetCorePositionInStack(Pos, MpId, Tmp) GetCorePositionInStack Pos, MpId, Tmp
-#endif
+#define SetPrimaryStack(StackTop,GlobalSize,Tmp) SetPrimaryStack StackTop, GlobalSize, Tmp
+#endif
#endif
diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc index 78e2ae2945..5644bf9b30 100644 --- a/ArmPkg/Include/AsmMacroIoLib.inc +++ b/ArmPkg/Include/AsmMacroIoLib.inc @@ -77,5 +77,21 @@ LoadConstantToRegMacro $Data, $Reg
ldr $Reg, =($Data)
MEND
+
+ MACRO
+ GetCorePositionInStack $Pos, $MpId, $Tmp
+ lsr $Pos, $MpId, #6
+ and $Tmp, $MpId, #3
+ add $Pos, $Pos, $Tmp
+ MEND
+
+ ; The reserved place must be 8-bytes aligned for pushing 64-bit variable on the stack
+ MACRO
+ SetPrimaryStack $StackTop, $GlobalSize, $Tmp
+ and $Tmp, $GlobalSize, #7
+ rsbne $Tmp, $Tmp, #8
+ add $GlobalSize, $GlobalSize, $Tmp
+ sub sp, $StackTop, $GlobalSize
+ MEND
END
|