summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Pei/Image
AgeCommit message (Collapse)AuthorFilesLines
2021-12-07MdeModulePkg: Apply uncrustify changesMichael Kubacki1-308/+327
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-12-07MdeModulePkg: Change OPTIONAL keyword usage styleMichael D Kinney1-4/+4
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-12-07MdeModulePkg: Change use of EFI_D_* to DEBUG_*Michael D Kinney1-11/+7
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739 Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2021-06-16PeiCore: Remove assertion when failing to load PE imageRay Ni1-4/+1
EFI_PEI_LOAD_FILE_PPI is invoked by DxeIpl for loading DxeCore. It's possible that the instance produced by PeiCore fails to load but other instances of EFI_PEI_LOAD_FILE_PPI can load. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn>
2020-07-28MdeModulePkg/PeiCore: Enable T-RAM evacuation in PeiCore (CVE-2019-11098)Michael Kubacki1-4/+126
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1614 Introduces new changes to PeiCore to move the contents of temporary RAM visible to the PeiCore to permanent memory. This expands on pre-existing shadowing support in the PeiCore to perform the following additional actions: 1. Migrate pointers in PPIs installed in PeiCore to the permanent memory copy of PeiCore. 2. Copy all installed firmware volumes to permanent memory. 3. Relocate and fix up the PEIMs within the firmware volumes. 4. Convert all PPIs into the migrated firmware volume to the corresponding PPI address in the permanent memory location. This applies to PPIs and PEI notifications. 5. Convert all status code callbacks in the migrated firmware volume to the corresponding address in the permanent memory location. 6. Update the FV HOB to the corresponding firmware volume in permanent memory. 7. Use PcdMigrateTemporaryRamFirmwareVolumes to control if enable the feature or not. when disable the PCD, the EvacuateTempRam() will never be called. The function control flow as below: PeiCore() DumpPpiList() EvacuateTempRam() ConvertPeiCorePpiPointers() ConvertPpiPointersFv() MigratePeimsInFv() MigratePeim() PeiGetPe32Data() LoadAndRelocatePeCoffImageInPlace() MigrateSecModulesInFv() ConvertPpiPointersFv() ConvertStatusCodeCallbacks() ConvertFvHob() RemoveFvHobsInTemporaryMemory() DumpPpiList() Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Debkumar De <debkumar.de@intel.com> Cc: Harry Han <harry.han@intel.com> Cc: Catharine West <catharine.west@intel.com> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
2019-12-11MdeModulePkg PeiCore: Fix typosMichael Kubacki1-5/+5
Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2019-04-09MdeModulePkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney1-7/+1
https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2018-09-07MdeModulePkg PeiCore: Always use PeiImageRead() function to load PEI imageLiming Gao1-84/+1
In V2, Remove GetImageReadFunction(), directly use PeiImageRead(). The copy PeiImageReadForShadow function doesn't improve the boot performance. This patch removes this copy logic to simplify the code logic. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2018-06-28MdeModulePkg: Clean up source filesLiming Gao1-25/+25
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2018-03-09MdeModulePkg/Core/Pei: fix REGISITER -> REGISTER typoMarc-André Lureau1-2/+2
No functional changes. Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2018-02-26MdeModulePkg PeiCore: Add error message to describe PEIM load failureLiming Gao1-1/+6
If PEIM image address doesn't meet with its section alignment, it will load fail. PeiCore adds more debug message to report it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-03-29MdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check archArd Biesheuvel1-3/+5
The EFI_IMAGE_MACHINE_TYPE_SUPPORTED() macro is abused in the PeiCore code to decide whether the system we are compiling for can deal with executable code being copied elsewhere and executed from there. As stated in the comment, this is fundamentally a property of the compiler target, and so this should be made dependent on MDE_CPU_xxx preprocessor defines, and not on whether or not the runtime target can deal with PE/COFF images of a certain machine type. On X86/IA32, this mostly boils down to the same thing, but not on other architectures, so let's clean this up. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-03-06MdeModulePkg: Refine casting expression result to bigger sizeHao Wu1-7/+5
There are cases that the operands of an expression are all with rank less than UINT64/INT64 and the result of the expression is explicitly cast to UINT64/INT64 to fit the target size. An example will be: UINT32 a,b; // a and b can be any unsigned int type with rank less than UINT64, like // UINT8, UINT16, etc. UINT64 c; c = (UINT64) (a + b); Some static code checkers may warn that the expression result might overflow within the rank of "int" (integer promotions) and the result is then cast to a bigger size. The commit refines codes by the following rules: 1). When the expression is possible to overflow the range of unsigned int/ int: c = (UINT64)a + b; 2). When the expression will not overflow within the rank of "int", remove the explicit type casts: c = a + b; 3). When the expression will be cast to pointer of possible greater size: UINT32 a,b; VOID *c; c = (VOID *)(UINTN)(a + b); --> c = (VOID *)((UINTN)a + b); 4). When one side of a comparison expression contains only operands with rank less than UINT32: UINT8 a; UINT16 b; UINTN c; if ((UINTN)(a + b) > c) {...} --> if (((UINT32)a + b) > c) {...} For rule 4), if we remove the 'UINTN' type cast like: if (a + b > c) {...} The VS compiler will complain with warning C4018 (signed/unsigned mismatch, level 3 warning) due to promoting 'a + b' to type 'int'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
2017-02-28MdeModulePkg/PeiCore: allocate BootServicesCode memory for PE/COFF imagesArd Biesheuvel1-9/+14
Ensure that any memory allocated for PE/COFF images is identifiable as a boot services code region, so that we know it requires its executable permissions to be preserved when we tighten mapping permissions later on. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-07-11MdeModulePkg: Fix typos in comments and variablesGiri P Mudusuru1-17/+17
- abstrated to abstracted - accessibla to accessible - addres to address - apropriate to appropriate - arry to array - availabe to available - avaliable to available - becasue to because - correponding to corresponding - etablished to established - exeuction to execution - extensiable to extensible - fileds to fields - loadding to loading - ptototypes to prototypes - prococol protocol - requried to required - resoruce to resource - runing to running - uild to build Cc: Star Zeng <star.zeng@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-02-29MdeModulePkg: Update PeiCore dispatcher to handle PEIM and PEI_CORE onlyLiming Gao1-3/+21
When PcdShadowPeimOnBoot is FALSE, they are not copied to memory and execute from their original locations. Here, this policy should only apply for PEIM and PEI_CORE, not for other file type, such as DXE_CORE. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Tested-by: Eugene Cohen <eugene@hp.com>
2015-08-03MdeModulePkg PeiCore: Add PCD to specify PEIM ShadowLiming Gao1-5/+28
v2 changelog: Check CurrentPeimHandle to check the matched PeimHandle. Add check point to ShadowPeiCore based on PCD. v1 changelog: PeiCore LoadImage always shadow itself and PEIM on normal boot after the physical memory is installed. On the emulator platform, the shadow may be not necessary. To support such usage, new PCD PcdShadowPeimOnBoot is introduced to specify whether loads PEIM in memory by default. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18125 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-111. Enable use-cases in PEI using SecurityPPI co-equal to the use-cases in ↵Star Zeng1-5/+9
DXE using the Security Arch Protocol 2. Add support to find section by instance rather than only 0 at PEI phase. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14763 6f19259b-4bc3-4df7-8a09-765794883524
2013-10-09Update PeiCore to support load PEIM into memory on S3 boot path. Liming Gao1-29/+61
Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14757 6f19259b-4bc3-4df7-8a09-765794883524
2013-02-27In order to make sure the image is section alignment, after allocate buffer ↵ydong101-3/+26
for TE image, it will adjust the base address. But it has two potential issues: One is the start address may not section alignment, second is the buffer is not bigger enough to do the adjustment. This patch fixes these two issues. Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14145 6f19259b-4bc3-4df7-8a09-765794883524
2012-02-29Fix the issue in PeiCore to support PDB file path without '\' or '.' character.lgao41-9/+27
Signed-off-by: lgao4 Reviewed-by: rsun3 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13069 6f19259b-4bc3-4df7-8a09-765794883524
2012-01-04Fix the issue in PeiCore that doesn’t handle Unix style file path of PDB file.lgao41-2/+2
Signed-off-by: lgao4 Reviewed-by:rsun3 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12906 6f19259b-4bc3-4df7-8a09-765794883524
2010-07-07Update the previous fix to only shadow the function for supported processor ↵andrewfish1-8/+8
architectrues. The old way required non supported processor architectures to opt out. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10637 6f19259b-4bc3-4df7-8a09-765794883524
2010-07-07Fix issue with ARM port. Image.c shadow code is not ANSI C and crashes on ↵andrewfish1-1/+6
ARM. So I did the same thing that is done on Itanium and skipped the shadow for ARM architecture in all cases. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10636 6f19259b-4bc3-4df7-8a09-765794883524
2010-05-07Fix ICC 11.1 build breakmdkinney1-3/+3
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10467 6f19259b-4bc3-4df7-8a09-765794883524
2010-04-24Update the copyright notice formathhtian1-2/+2
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10420 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-24Avoid shadowing PE image read function on IPFjgong51-1/+1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10057 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-22Enhance memory copy logic for PEI core image read. The change uses CopyMem() ↵jgong51-7/+43
library function for unshadowed version and uses inline implementation for a shadowed version. This reduces PE image reading time to 1/5 - 1/10 when code cache is disabled. The change also fixed a memory leak when allocating shadow space for image read function. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10038 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-10revise the debug message to add 0x in front of the HEX number for consistencyjchen201-3/+3
replace FixedPcdGetXX with PcdGetXX to access PcdLoadModuleAtFixAddressEnable git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9964 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-05Enable the Load Module At fixed Address feature jchen201-30/+226
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9937 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-26Print the warning information for the image without relocation only when ↵lgao41-2/+2
load it into memory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9822 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-24Correct PeiCore not dispatch the register for shadow image without relocation.lgao41-8/+90
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9796 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-15Update PeiLoadFilePpi produced by PeiCore to load only images with ↵lgao41-1/+1
relocation into memory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9775 6f19259b-4bc3-4df7-8a09-765794883524
2009-11-16Remove a typoklu21-1/+1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9429 6f19259b-4bc3-4df7-8a09-765794883524
2009-11-16Initialize the FileHandle to NULL, before search FV image file in discoveried FVklu21-0/+1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9428 6f19259b-4bc3-4df7-8a09-765794883524
2009-10-26For now PEI Core LoadImage() service to always call ↵jchen201-3/+3
LoadAndRelocatePeCoffImage() even for XIP PEIMs.However the AllocatePage invoked in S3 path will make system assert. The patch is to fix it. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9368 6f19259b-4bc3-4df7-8a09-765794883524
2009-10-08PEI Core: Remove unused variable in PeiLoadImageLoadImage function.jljusten1-3/+0
The ICC compiler generated a warning due to this unused variable. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9334 6f19259b-4bc3-4df7-8a09-765794883524
2009-10-01Update PEI Core LoadImage() service to always call ↵mdkinney1-49/+55
LoadAndRelocatePeCoffImage() even for XIP PEIMs. This will guarantee that the PE/COFF Extra Action Lib will be called for all PE/COFF images, even XIP PEIMs. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9327 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-17Make ASSERT statement more meaningful.lgao41-4/+4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9276 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-16Enhance PeiCore and DxeCore check whether the image machine type is ↵lgao41-0/+7
supported when start image. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9266 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-111. Update IA32 PeiCore implementation to support load x64 image for ↵qhuang81-15/+5
EFI_PEI_LOAD_FILE_PPI. 2. Simplify the implementation of PeiLoadImage() in PeiCore to skip the function call of PeiLoadImageLoadImage() because PeiCore itself produce one instance of EFI_PEI_LOAD_FILE_PPI. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9045 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-05Use UEFI macros for PE/COFF image typesmdkinney1-1/+1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7441 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-03Global variables have been moved backward ahead of functions.jji41-23/+0
Only a few cases were left due to its module structure. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6816 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-31Use #include "XXX.h" for module internal header files.qhuang81-1/+1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6333 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-30Patch to remove STATIC modifier. This is on longer recommended by EFI ↵jji41-2/+2
Framework coding style. All duplicated symbols has been renamed accordingly. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6296 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-211) Update SetPeiServicesTablePointer's prototype add CONST modifier.qwang121-1/+1
2) Move STRING_REF from MdePkg/Include/Uefi/UefiBaseType.h to IntelFramework/Include/Protocol/FrameworkHii.h. 3) Move RELOFST from MdePkg/Include/Uefi/UefiInternalFormRepresentation.h to IntelFramework/Include/Protocol/FrameworkHii.h. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6166 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-20Fix ECC issue.klu21-1/+1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6142 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-17Base on PI spec, GetPeiServicesTablePointer is updated to return CONST ↵qwang121-1/+1
EFI_PEI_SERVICES**. This is a incompatible changes. All file that reference this must be updated. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6127 6f19259b-4bc3-4df7-8a09-765794883524
2008-09-04clean up the un-suitable ';' location when declaring the functions.vanjeff1-2/+1
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5820 6f19259b-4bc3-4df7-8a09-765794883524
2008-08-08Roll back PeiImageRead to original implementation, this function will be ↵lgao41-1/+11
shadowed, so it can't be replaced by CopyMem Api. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5622 6f19259b-4bc3-4df7-8a09-765794883524