From 3076397e4b8f6baaea994da79b3c4e934a5f31d7 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Thu, 15 Nov 2007 09:00:14 +0000 Subject: [PATCH] Add a feature flag to allow platform developer to decide if TE or PE32 section should be searched in PEI dispatcher. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4298 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Pei/Image/Image.c | 18 ++++++++++++++---- MdeModulePkg/Core/Pei/PeiMain.inf | 6 ++++-- MdeModulePkg/MdeModulePkg.dec | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index ecb9de7684..0c627c17b4 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -326,25 +326,35 @@ Returns: UINT16 Machine; PEI_CORE_INSTANCE *Private; VOID *EntryPointArg; + EFI_SECTION_TYPE SearchType1; + EFI_SECTION_TYPE SearchType2; *EntryPoint = 0; ImageSize = 0; *AuthenticationState = 0; + if (FeaturePcdGet (PcdPeiCoreImageLoaderSearchTeSectionFirst)) { + SearchType1 = EFI_SECTION_TE; + SearchType2 = EFI_SECTION_PE32; + } else { + SearchType1 = EFI_SECTION_PE32; + SearchType2 = EFI_SECTION_TE; + } // - // Try to find a TE section. + // Try to find a first exe section (if PcdPeiCoreImageLoaderSearchTeSectionFirst + // is true, TE will be searched first). // Status = PeiServicesFfsFindSectionData ( - EFI_SECTION_TE, + SearchType1, FileHandle, &Pe32Data ); // - // If we didn't find a TE section, try to find a PE32 section. + // If we didn't find a first exe section, try to find the second exe section. // if (EFI_ERROR (Status)) { Status = PeiServicesFfsFindSectionData ( - EFI_SECTION_PE32, + SearchType2, FileHandle, &Pe32Data ); diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiMain.inf index 392a548e24..b9787f81e8 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.inf +++ b/MdeModulePkg/Core/Pei/PeiMain.inf @@ -102,6 +102,8 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv -[BuildOptions.common] - MSFT:DEBUG_*_IA32_CC_FLAGS = /FAcs +[FeaturePcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst + + diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index c7ed1b2daa..a4a74cbf5b 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -119,6 +119,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdUnicodeCollation2Support|TRUE|BOOLEAN|0x00010041 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE|BOOLEAN|0x00010042 gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|TRUE|BOOLEAN|0x00010043 + gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|TRUE|BOOLEAN|0x00010044 [PcdsFixedAtBuild.common] gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry|0x08|UINT32|0x0001000f