ArmPlatformPkg/PrePiHobListPointerLib: Fixed pointer calculation

In the PrePi module, the global variables are located at the top of the stack.
At the opposite of the PeiCore where the global variables are located in the
middle of the stack. The top stack region is reserved for Temporary Memory.



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12167 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2011-08-18 11:23:28 +00:00
parent 3757392733
commit e1808603dc
2 changed files with 16 additions and 19 deletions

View File

@ -17,14 +17,6 @@
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
//
// Have to use build system to set the original value in case we are running
// from FLASH and globals don't work. So if you do a GetHobList() and gHobList
// and gHobList is NULL the PCD default values are used.
//
VOID *gHobList = NULL;
/** /**
Returns the pointer to the HOB list. Returns the pointer to the HOB list.
@ -39,11 +31,10 @@ PrePeiGetHobList (
VOID VOID
) )
{ {
if (gHobList == NULL) { return (VOID *)*(UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) +
return (VOID *)*(UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) + (PcdGet32 (PcdCPUCoresNonSecStackSize) / 2) - PcdGet32 (PcdHobListPtrGlobalOffset)); PcdGet32 (PcdCPUCoresNonSecStackSize) -
} else { PcdGet32 (PcdPeiGlobalVariableSize) +
return gHobList; PcdGet32 (PcdHobListPtrGlobalOffset));
}
} }
@ -60,10 +51,15 @@ PrePeiSetHobList (
IN VOID *HobList IN VOID *HobList
) )
{ {
gHobList = HobList; UINTN* HobListPtr;
// HobListPtr = (UINTN*)(PcdGet32 (PcdCPUCoresNonSecStackBase) +
// If this code is running from ROM this could fail PcdGet32 (PcdCPUCoresNonSecStackSize) -
// PcdGet32 (PcdPeiGlobalVariableSize) +
return (gHobList == HobList) ? EFI_SUCCESS: EFI_UNSUPPORTED; PcdGet32 (PcdHobListPtrGlobalOffset));
*HobListPtr = (UINTN)HobList;
return EFI_SUCCESS;
} }

View File

@ -34,4 +34,5 @@
gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset gArmPlatformTokenSpaceGuid.PcdHobListPtrGlobalOffset
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackBase
gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize gArmPlatformTokenSpaceGuid.PcdCPUCoresNonSecStackSize
gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize