summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-08 07:49:10 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-08 07:49:10 +0000
commit66c69dea0dfdf1e7138b97f1fb74f529813b6553 (patch)
treebcb2f028a3731f838a0fd7ba776f19f602eddab4
parent24196608274c9e9699c58c2da34cf8d0109f2d7c (diff)
downloadedk2-66c69dea0dfdf1e7138b97f1fb74f529813b6553.zip
edk2-66c69dea0dfdf1e7138b97f1fb74f529813b6553.tar.gz
edk2-66c69dea0dfdf1e7138b97f1fb74f529813b6553.tar.bz2
PeiCore should fixup heap/stack pointer according to heap's/stack's base address separately.
After this check-in, PeiCore will do not make any assumption of heap/stack layout in CAR. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5421 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index 079e798..c4c97e1 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -274,7 +274,8 @@ Returns:
TEMPORARY_RAM_SUPPORT_PPI *TemporaryRamSupportPpi;
EFI_HOB_HANDOFF_INFO_TABLE *OldHandOffTable;
EFI_HOB_HANDOFF_INFO_TABLE *NewHandOffTable;
- INTN Offset;
+ INTN StackOffset;
+ INTN HeapOffset;
PEI_CORE_INSTANCE *PrivateInMem;
UINT64 NewPeiStackSize;
UINT64 OldPeiStackSize;
@@ -484,7 +485,7 @@ Returns:
if (Private->StackSize > OldPeiStackSize) {
StackGap = Private->StackSize - OldPeiStackSize;
}
-
+
//
// Update HandOffHob for new installed permenent memory
//
@@ -497,9 +498,13 @@ Returns:
// CAUTION: The new base is computed accounding to gap of new stack.
//
NewPermenentMemoryBase = Private->PhysicalMemoryBegin + StackGap;
- Offset = (UINTN) NewPermenentMemoryBase - (UINTN) SecCoreData->TemporaryRamBase;
- NewHandOffTable = (EFI_HOB_HANDOFF_INFO_TABLE *)((UINTN)OldHandOffTable + Offset);
- PrivateInMem = (PEI_CORE_INSTANCE *)((UINTN) (VOID*) Private + Offset);
+ StackOffset = (UINTN) NewPermenentMemoryBase - (UINTN) SecCoreData->StackBase;
+ HeapOffset = (INTN) ((UINTN) Private->PhysicalMemoryBegin + Private->StackSize - \
+ (UINTN) SecCoreData->PeiTemporaryRamBase);
+ DEBUG ((EFI_D_INFO, "Heap Offset = 0x%X Stack Offset = 0x%X\n", HeapOffset, StackOffset));
+
+ NewHandOffTable = (EFI_HOB_HANDOFF_INFO_TABLE *)((UINTN)OldHandOffTable + HeapOffset);
+ PrivateInMem = (PEI_CORE_INSTANCE *)((UINTN) (VOID*) Private + StackOffset);
//
// TemporaryRamSupportPpi is produced by platform's SEC
@@ -536,7 +541,7 @@ Returns:
//
PrivateInMem->PS = &PrivateInMem->ServiceTableShadow;
PrivateInMem->CpuIo = &PrivateInMem->ServiceTableShadow.CpuIo;
- PrivateInMem->HobList.Raw = (VOID*) ((UINTN) PrivateInMem->HobList.Raw + Offset);
+ PrivateInMem->HobList.Raw = (VOID*) ((UINTN) PrivateInMem->HobList.Raw + HeapOffset);
PrivateInMem->StackBase = (EFI_PHYSICAL_ADDRESS)(((UINTN)PrivateInMem->PhysicalMemoryBegin + EFI_PAGE_MASK) & ~EFI_PAGE_MASK);
PeiServices = &PrivateInMem->PS;
@@ -550,7 +555,7 @@ Returns:
// Update HandOffHob for new installed permenent memory
//
NewHandOffTable->EfiEndOfHobList =
- (EFI_PHYSICAL_ADDRESS)((UINTN) NewHandOffTable->EfiEndOfHobList + Offset);
+ (EFI_PHYSICAL_ADDRESS)((UINTN) NewHandOffTable->EfiEndOfHobList + HeapOffset);
NewHandOffTable->EfiMemoryTop = PrivateInMem->PhysicalMemoryBegin +
PrivateInMem->PhysicalMemoryLength;
NewHandOffTable->EfiMemoryBottom = PrivateInMem->PhysicalMemoryBegin;