summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Pei
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-20 09:17:48 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-20 09:17:48 +0000
commit2740a797df7ee56e4aa11fab46a8bc6ead91369f (patch)
tree926c9c2f4811ff1e7bd9e1f5c75d21bfb8d69507 /MdeModulePkg/Core/Pei
parent83283ef1ceaf9ca1372986c0a825c6aa261a61af (diff)
downloadedk2-2740a797df7ee56e4aa11fab46a8bc6ead91369f.zip
edk2-2740a797df7ee56e4aa11fab46a8bc6ead91369f.tar.gz
edk2-2740a797df7ee56e4aa11fab46a8bc6ead91369f.tar.bz2
MdeModulePkg PeiMain: Enhance the PEI Core to convert GUID/PPI pointers pointing to somewhere in the temporary stack in PPI descriptors.
Signed-off-by: rsun3 Reviewed-by: lzeng14 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12390 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Pei')
-rw-r--r--MdeModulePkg/Core/Pei/Ppi/Ppi.c53
1 files changed, 44 insertions, 9 deletions
diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
index 9129c23..6664b5b 100644
--- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
+++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
@@ -105,15 +105,15 @@ ConvertPpiPointers (
if (Index < PrivateData->PpiData.PpiListEnd &&
(UINTN)PpiPointer->Ppi->Ppi < OldHeapTop &&
(UINTN)PpiPointer->Ppi->Ppi >= OldHeapBottom) {
- //
- // Convert the pointer to the PPI interface structure in the PPI descriptor
- // from the old HOB heap to the relocated HOB heap.
- //
- if (PrivateData->HeapOffsetPositive) {
- PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi + PrivateData->HeapOffset);
- } else {
- PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi - PrivateData->HeapOffset);
- }
+ //
+ // Convert the pointer to the PPI interface structure in the PPI descriptor
+ // from the old HOB heap to the relocated HOB heap.
+ //
+ if (PrivateData->HeapOffsetPositive) {
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi + PrivateData->HeapOffset);
+ } else {
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi - PrivateData->HeapOffset);
+ }
}
} else if (((UINTN)PpiPointer->Raw < OldStackTop) && ((UINTN)PpiPointer->Raw >= OldStackBottom)) {
//
@@ -125,6 +125,41 @@ ConvertPpiPointers (
} else {
PpiPointer->Raw = (VOID *) ((UINTN)PpiPointer->Raw - PrivateData->StackOffset);
}
+
+ //
+ // Try to convert the pointers in the PEIM descriptor
+ //
+
+ if (((UINTN)PpiPointer->Ppi->Guid < OldStackTop) &&
+ ((UINTN)PpiPointer->Ppi->Guid >= OldStackBottom)) {
+ //
+ // Convert the pointer to the GUID in the PPI or NOTIFY descriptor
+ // from the the temporary stack to the permanent PEI stack.
+ //
+ if (PrivateData->StackOffsetPositive) {
+ PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid + PrivateData->StackOffset);
+ } else {
+ PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid - PrivateData->StackOffset);
+ }
+ }
+
+ //
+ // Assume that no code is located in the temporary memory, so the pointer to
+ // the notification function in the NOTIFY descriptor needs not be converted.
+ //
+ if (Index < PrivateData->PpiData.PpiListEnd &&
+ (UINTN)PpiPointer->Ppi->Ppi < OldStackTop &&
+ (UINTN)PpiPointer->Ppi->Ppi >= OldStackBottom) {
+ //
+ // Convert the pointer to the PPI interface structure in the PPI descriptor
+ // from the the temporary stack to the permanent PEI stack.
+ //
+ if (PrivateData->StackOffsetPositive) {
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi + PrivateData->StackOffset);
+ } else {
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi - PrivateData->StackOffset);
+ }
+ }
}
}
}