if (Index < PrivateData->PpiData.PpiListEnd &&\r
(UINTN)PpiPointer->Ppi->Ppi < OldHeapTop &&\r
(UINTN)PpiPointer->Ppi->Ppi >= OldHeapBottom) {\r
- //\r
- // Convert the pointer to the PPI interface structure in the PPI descriptor\r
- // from the old HOB heap to the relocated HOB heap.\r
- //\r
- if (PrivateData->HeapOffsetPositive) {\r
- PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi + PrivateData->HeapOffset);\r
- } else {\r
- PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi - PrivateData->HeapOffset);\r
- }\r
+ //\r
+ // Convert the pointer to the PPI interface structure in the PPI descriptor\r
+ // from the old HOB heap to the relocated HOB heap.\r
+ //\r
+ if (PrivateData->HeapOffsetPositive) {\r
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi + PrivateData->HeapOffset);\r
+ } else {\r
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi - PrivateData->HeapOffset);\r
+ }\r
}\r
} else if (((UINTN)PpiPointer->Raw < OldStackTop) && ((UINTN)PpiPointer->Raw >= OldStackBottom)) {\r
//\r
} else {\r
PpiPointer->Raw = (VOID *) ((UINTN)PpiPointer->Raw - PrivateData->StackOffset);\r
}\r
+\r
+ //\r
+ // Try to convert the pointers in the PEIM descriptor\r
+ //\r
+\r
+ if (((UINTN)PpiPointer->Ppi->Guid < OldStackTop) &&\r
+ ((UINTN)PpiPointer->Ppi->Guid >= OldStackBottom)) {\r
+ //\r
+ // Convert the pointer to the GUID in the PPI or NOTIFY descriptor\r
+ // from the the temporary stack to the permanent PEI stack.\r
+ //\r
+ if (PrivateData->StackOffsetPositive) {\r
+ PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid + PrivateData->StackOffset);\r
+ } else {\r
+ PpiPointer->Ppi->Guid = (VOID *) ((UINTN)PpiPointer->Ppi->Guid - PrivateData->StackOffset);\r
+ }\r
+ }\r
+\r
+ //\r
+ // Assume that no code is located in the temporary memory, so the pointer to\r
+ // the notification function in the NOTIFY descriptor needs not be converted.\r
+ //\r
+ if (Index < PrivateData->PpiData.PpiListEnd &&\r
+ (UINTN)PpiPointer->Ppi->Ppi < OldStackTop &&\r
+ (UINTN)PpiPointer->Ppi->Ppi >= OldStackBottom) {\r
+ //\r
+ // Convert the pointer to the PPI interface structure in the PPI descriptor\r
+ // from the the temporary stack to the permanent PEI stack.\r
+ //\r
+ if (PrivateData->StackOffsetPositive) {\r
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi + PrivateData->StackOffset);\r
+ } else {\r
+ PpiPointer->Ppi->Ppi = (VOID *) ((UINTN)PpiPointer->Ppi->Ppi - PrivateData->StackOffset);\r
+ }\r
+ }\r
}\r
}\r
}\r