ArmPlatformPkg/ArmPlatformGlobalVariableLib: Added new function ArmPlatformGetGlobalVariableAddress()
This function returns the address of a Global Variable in the Global Variable Region. Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13246 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -83,3 +83,23 @@ ArmPlatformSetGlobalVariable (
|
||||
}
|
||||
}
|
||||
|
||||
VOID*
|
||||
ArmPlatformGetGlobalVariableAddress (
|
||||
IN UINTN VariableOffset
|
||||
)
|
||||
{
|
||||
UINTN GlobalVariableBase;
|
||||
|
||||
// Ensure the Global Variable Size have been initialized
|
||||
ASSERT (VariableOffset < PcdGet32 (PcdPeiGlobalVariableSize));
|
||||
|
||||
if (IS_XIP()) {
|
||||
// In Case of XIP, we expect the Primary Stack at the top of the System Memory
|
||||
// The size must be 64bit aligned to allow 64bit variable to be aligned
|
||||
GlobalVariableBase = PcdGet32 (PcdSystemMemoryBase) + PcdGet32 (PcdSystemMemorySize) - ALIGN_VALUE(PcdGet32 (PcdPeiGlobalVariableSize),0x8);
|
||||
} else {
|
||||
GlobalVariableBase = mGlobalVariableBase;
|
||||
}
|
||||
|
||||
return (VOID*)(GlobalVariableBase + VariableOffset);
|
||||
}
|
||||
|
Reference in New Issue
Block a user