Fix one bug in PeiExtractGuidedSectionLib to convert the address after hob start address is changed.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4398 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2007-12-18 06:15:55 +00:00
parent a182eb4624
commit e111752c18
2 changed files with 23 additions and 5 deletions

View File

@ -206,7 +206,7 @@ InternalAllocateAlignedPages (
return NULL; return NULL;
} }
AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask; AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
UnalignedPages = EFI_SIZE_TO_PAGES ((UINTN) Memory - AlignedMemory); UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
if (UnalignedPages > 0) { if (UnalignedPages > 0) {
// //
// Free first unaligned page(s). // Free first unaligned page(s).

View File

@ -63,6 +63,24 @@ PeiGetExtractGuidedSectionHandlerInfo (
if (CompareGuid (&(Hob.Guid->Name), &gEfiCallerIdGuid)) { if (CompareGuid (&(Hob.Guid->Name), &gEfiCallerIdGuid)) {
HandlerInfo = (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *) GET_GUID_HOB_DATA (Hob.Guid); HandlerInfo = (PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *) GET_GUID_HOB_DATA (Hob.Guid);
if (HandlerInfo->Signature == PEI_EXTRACT_HANDLER_INFO_SIGNATURE) { if (HandlerInfo->Signature == PEI_EXTRACT_HANDLER_INFO_SIGNATURE) {
//
// Update Table Pointer when hob start address is changed.
//
if (HandlerInfo->ExtractHandlerGuidTable != (GUID *) (HandlerInfo + 1)) {
HandlerInfo->ExtractHandlerGuidTable = (GUID *) (HandlerInfo + 1);
HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (
(UINT8 *)HandlerInfo->ExtractHandlerGuidTable +
PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)
);
HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (
(UINT8 *)HandlerInfo->ExtractDecodeHandlerTable +
PcdGet32 (PcdMaximumGuidedExtractHandler) *
sizeof (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER)
);
}
//
// Return HandlerInfo pointer.
//
*InfoPointer = HandlerInfo; *InfoPointer = HandlerInfo;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -173,7 +191,7 @@ ExtractGuidedSectionRegisterHandlers (
// Search the match registered GetInfo handler for the input guided section. // Search the match registered GetInfo handler for the input guided section.
// //
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) { for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
if (CompareGuid (&(HandlerInfo->ExtractHandlerGuidTable[Index]), SectionGuid)) { if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
break; break;
} }
} }
@ -197,7 +215,7 @@ ExtractGuidedSectionRegisterHandlers (
// //
// Register new Handler and guid value. // Register new Handler and guid value.
// //
CopyGuid (&(HandlerInfo->ExtractHandlerGuidTable [HandlerInfo->NumberOfExtractHandler]), SectionGuid); CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid);
HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler; HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler;
HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler; HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;
@ -261,7 +279,7 @@ ExtractGuidedSectionGetInfo (
// Search the match registered GetInfo handler for the input guided section. // Search the match registered GetInfo handler for the input guided section.
// //
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) { for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
if (CompareGuid (&(HandlerInfo->ExtractHandlerGuidTable[Index]), &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
break; break;
} }
} }
@ -338,7 +356,7 @@ ExtractGuidedSectionDecode (
// Search the match registered GetInfo handler for the input guided section. // Search the match registered GetInfo handler for the input guided section.
// //
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) { for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
if (CompareGuid (&(HandlerInfo->ExtractHandlerGuidTable[Index]), &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) { if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
break; break;
} }
} }