diff options
-rw-r--r-- | MdeModulePkg/Core/Pei/Image/Image.c | 18 | ||||
-rw-r--r-- | MdeModulePkg/Core/Pei/PeiMain.inf | 6 | ||||
-rw-r--r-- | 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
|