X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FCore%2FPei%2FPeiMain%2FPeiMain.c;fp=MdeModulePkg%2FCore%2FPei%2FPeiMain%2FPeiMain.c;h=4869bf18f005ad0f741d8031130233c94cc9b0bf;hp=52adefeb44b4cfc969c1138887a63eb061aff2ed;hb=111e6c920d156e4160af1956747e6b8614f70f77;hpb=aa8c6e2ad388888af6bec9aea1ff252b75dd34dd diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c index 52adefeb44..4869bf18f0 100644 --- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c +++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c @@ -184,13 +184,15 @@ PeiCore ( OldCoreData->CpuIo = &OldCoreData->ServiceTableShadow.CpuIo; if (OldCoreData->HeapOffsetPositive) { OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw + OldCoreData->HeapOffset); - OldCoreData->UnknownFvInfo = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo + OldCoreData->HeapOffset); + if (OldCoreData->UnknownFvInfo != NULL) { + OldCoreData->UnknownFvInfo = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo + OldCoreData->HeapOffset); + } if (OldCoreData->CurrentFvFileHandles != NULL) { OldCoreData->CurrentFvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->CurrentFvFileHandles + OldCoreData->HeapOffset); } OldCoreData->PpiData.PpiListPtrs = (PEI_PPI_LIST_POINTERS *) ((UINT8 *) OldCoreData->PpiData.PpiListPtrs + OldCoreData->HeapOffset); OldCoreData->Fv = (PEI_CORE_FV_HANDLE *) ((UINT8 *) OldCoreData->Fv + OldCoreData->HeapOffset); - for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) { + for (Index = 0; Index < OldCoreData->FvCount; Index ++) { if (OldCoreData->Fv[Index].PeimState != NULL) { OldCoreData->Fv[Index].PeimState = (UINT8 *) OldCoreData->Fv[Index].PeimState + OldCoreData->HeapOffset; } @@ -202,13 +204,15 @@ PeiCore ( OldCoreData->TempFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->TempFileHandles + OldCoreData->HeapOffset); } else { OldCoreData->HobList.Raw = (VOID *)(OldCoreData->HobList.Raw - OldCoreData->HeapOffset); - OldCoreData->UnknownFvInfo = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo - OldCoreData->HeapOffset); + if (OldCoreData->UnknownFvInfo != NULL) { + OldCoreData->UnknownFvInfo = (PEI_CORE_UNKNOW_FORMAT_FV_INFO *) ((UINT8 *) OldCoreData->UnknownFvInfo - OldCoreData->HeapOffset); + } if (OldCoreData->CurrentFvFileHandles != NULL) { OldCoreData->CurrentFvFileHandles = (EFI_PEI_FILE_HANDLE *) ((UINT8 *) OldCoreData->CurrentFvFileHandles - OldCoreData->HeapOffset); } OldCoreData->PpiData.PpiListPtrs = (PEI_PPI_LIST_POINTERS *) ((UINT8 *) OldCoreData->PpiData.PpiListPtrs - OldCoreData->HeapOffset); OldCoreData->Fv = (PEI_CORE_FV_HANDLE *) ((UINT8 *) OldCoreData->Fv - OldCoreData->HeapOffset); - for (Index = 0; Index < PcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) { + for (Index = 0; Index < OldCoreData->FvCount; Index ++) { if (OldCoreData->Fv[Index].PeimState != NULL) { OldCoreData->Fv[Index].PeimState = (UINT8 *) OldCoreData->Fv[Index].PeimState - OldCoreData->HeapOffset; } @@ -339,10 +343,6 @@ PeiCore ( // PrivateData.PpiData.PpiListPtrs = AllocateZeroPool (sizeof (PEI_PPI_LIST_POINTERS) * PcdGet32 (PcdPeiCoreMaxPpiSupported)); ASSERT (PrivateData.PpiData.PpiListPtrs != NULL); - PrivateData.Fv = AllocateZeroPool (sizeof (PEI_CORE_FV_HANDLE) * PcdGet32 (PcdPeiCoreMaxFvSupported)); - ASSERT (PrivateData.Fv != NULL); - PrivateData.UnknownFvInfo = AllocateZeroPool (sizeof (PEI_CORE_UNKNOW_FORMAT_FV_INFO) * PcdGet32 (PcdPeiCoreMaxFvSupported)); - ASSERT (PrivateData.UnknownFvInfo != NULL); } InitializePpiServices (&PrivateData, OldCoreData);