/** @file\r
*\r
-* Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+* Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
*\r
* This program and the accompanying materials\r
* are licensed and made available under the terms and conditions of the BSD License\r
#include <Library/PcdLib.h>\r
#include <Library/DebugLib.h>\r
\r
-#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize))) || \\r
+extern UINT64 mSystemMemoryEnd;\r
+\r
+#define IS_XIP() (((UINT32)PcdGet64 (PcdFdBaseAddress) > (UINT32)(mSystemMemoryEnd)) || \\r
((PcdGet64 (PcdFdBaseAddress) + PcdGet32 (PcdFdSize)) < PcdGet64 (PcdSystemMemoryBase)))\r
\r
// Declared by ArmPlatformPkg/PrePi Module\r
if (IS_XIP()) {\r
// In Case of XIP, we expect the Primary Stack at the top of the System Memory\r
// The size must be 64bit aligned to allow 64bit variable to be aligned\r
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);\r
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);\r
} else {\r
GlobalVariableBase = mGlobalVariableBase;\r
}\r
if (IS_XIP()) {\r
// In Case of XIP, we expect the Primary Stack at the top of the System Memory\r
// The size must be 64bit aligned to allow 64bit variable to be aligned\r
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);\r
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);\r
} else {\r
GlobalVariableBase = mGlobalVariableBase;\r
}\r
if (IS_XIP()) {\r
// In Case of XIP, we expect the Primary Stack at the top of the System Memory\r
// The size must be 64bit aligned to allow 64bit variable to be aligned\r
- GlobalVariableBase = PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);\r
+ GlobalVariableBase = mSystemMemoryEnd + 1 - ALIGN_VALUE (PcdGet32 (PcdPeiGlobalVariableSize), 0x8);\r
} else {\r
GlobalVariableBase = mGlobalVariableBase;\r
}\r