/** @file\r
Macros to work around lack of Apple support for LDR register, =expr\r
\r
- Copyright (c) 2008-2009 Apple Inc. All rights reserved.<BR>\r
+ Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
\r
- All rights reserved. This program and the accompanying materials\r
+ This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
.long (_Data) ; \\r
1:\r
\r
+// Convert the (ClusterId,CoreId) into a Core Position\r
+// We assume there are 4 cores per cluster\r
+#define GetCorePositionInStack(Pos, MpId, Tmp) \\r
+ lsr Pos, MpId, #6 ; \\r
+ and Tmp, MpId, #3 ; \\r
+ add Pos, Pos, Tmp\r
+\r
+// Reserve a region at the top of the Primary Core stack\r
+// for Global variables for the XIP phase\r
+#define SetPrimaryStack(StackTop, GlobalSize, Tmp) \\r
+ and Tmp, GlobalSize, #7 ; \\r
+ rsbne Tmp, Tmp, #8 ; \\r
+ add GlobalSize, GlobalSize, Tmp ; \\r
+ sub sp, StackTop, GlobalSize\r
+\r
\r
#elif defined (__GNUC__)\r
\r
#define LoadConstantToReg(Data, Reg) \\r
ldr Reg, =Data\r
\r
+#define GetCorePositionInStack(Pos, MpId, Tmp) \\r
+ lsr Pos, MpId, #6 ; \\r
+ and Tmp, MpId, #3 ; \\r
+ add Pos, Pos, Tmp\r
+\r
+#define SetPrimaryStack(StackTop, GlobalSize, Tmp) \\r
+ and Tmp, GlobalSize, #7 ; \\r
+ rsbne Tmp, Tmp, #8 ; \\r
+ add GlobalSize, GlobalSize, Tmp ; \\r
+ sub sp, StackTop, GlobalSize\r
+\r
#else\r
\r
//\r
// conditional load testing eq flag\r
#define LoadConstantToRegIfEq(Data, Reg) LoadConstantToRegIfEqMacro Data, Reg\r
\r
+#define GetCorePositionInStack(Pos, MpId, Tmp) GetCorePositionInStack Pos, MpId, Tmp\r
\r
-#endif\r
+#define SetPrimaryStack(StackTop,GlobalSize,Tmp) SetPrimaryStack StackTop, GlobalSize, Tmp\r
\r
+#endif\r
\r
#endif\r