Commit Graph

71 Commits

Author SHA1 Message Date
Eric Dong a8d8d43051 Support load 64 bit image from 32 bit core.
Add more enhancement to check invalid PE format.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen, Yao <jiewen.yao@intel.com>
Reviewed-by: Liming, Gao <liming.gao@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15387 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-25 05:04:21 +00:00
jyao1 2080f676df Add more check for PE COFF SizeOfHeader field.
Signed-off by: jiewen yao <jiewen.yao@intel.com>
reviewed by: eric dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15233 6f19259b-4bc3-4df7-8a09-765794883524
2014-02-12 06:04:58 +00:00
ydong10 bf29dc16e6 Checks the TE image before use it.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Yao, Jiewen <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14024 6f19259b-4bc3-4df7-8a09-765794883524
2012-12-26 04:33:15 +00:00
ydong10 f2e444778e Remove the ASSERT (FALSE) code, just return unsupported.
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13985 6f19259b-4bc3-4df7-8a09-765794883524
2012-12-06 09:10:44 +00:00
ydong10 72ccedbd76 Enhance the check for RelocBase->SizeOfBlock before use it.
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13973 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-28 03:26:58 +00:00
ydong10 9ca9935a96 Enhance the check for some fields in the PE image before use it.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao<jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13972 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-28 02:49:49 +00:00
ydong10 713ffa208e Enhance the check for resource section data.
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13962 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-26 02:17:21 +00:00
ydong10 36b48bf641 Enhance the check for debug data before get the PdbPointer.
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13961 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-26 01:53:31 +00:00
ydong10 f8ffa6d763 Remove the useless code.
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13954 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-20 02:53:21 +00:00
ydong10 0054ce562f Enhance the error code info.
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13716 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-11 10:53:37 +00:00
ydong10 158e788f78 Enhance the comments.
Signed-off-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Ye Ting  <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13715 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-11 10:26:44 +00:00
ydong10 60893cc3a8 Enhance the check for some fields in the PE image before use it.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao<jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13665 6f19259b-4bc3-4df7-8a09-765794883524
2012-08-22 08:04:53 +00:00
ydong10 3acb198567 Enhance the check when ImageRead function return.
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ye Ting  <ting.ye@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13657 6f19259b-4bc3-4df7-8a09-765794883524
2012-08-21 08:38:58 +00:00
jyao1 dc204d5a0f Add comment for modules which have external input.
signed-off-by: jiewen.yao@intel.com
reviewed-by: guo.dong@intel.com
reviewed-by: ting.ye@intel.com
reviewed-by: liming.gao@intel.com
reviewed-by: elvin.li@intel.com



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13446 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-12 08:28:43 +00:00
ydong10 00b7e3e3a2 Update the logic related to get section header offset for TE image.
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@13273 6f19259b-4bc3-4df7-8a09-765794883524
2012-05-04 05:11:07 +00:00
ydong10 e0192326ae Patch include:
1.Change function name to avoid name conflict.
2.Refine check for Pe Image.

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@13220 6f19259b-4bc3-4df7-8a09-765794883524
2012-04-26 01:50:34 +00:00
ydong10 28186d4566 Validate some fields in PE image to make sure not access violation for later code.
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@13211 6f19259b-4bc3-4df7-8a09-765794883524
2012-04-24 03:00:32 +00:00
ydong10 be30ddf795 Update the offset when read every debug entries info.
Signed-off-by: ydong10
Reviewed-by: lgao4

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13104 6f19259b-4bc3-4df7-8a09-765794883524
2012-03-16 03:22:38 +00:00
andrewfish bab427db7d MdePkg: Fix X64 clang compile issues.
Fixed issues with X64 clang, and also make StackSwitch push a zero on the new stack to prevent a stack unwind into memory that is no longer valid.

signed-off-by: andrewfish
reviewed-by: lgao4
reviewed-by: mdkinney



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12007 6f19259b-4bc3-4df7-8a09-765794883524
2011-07-12 03:01:34 +00:00
lgao4 6beb225a9a Per PI1.2B spec, for the case that TE Image Relocation Data Directory Entry Virtual Address is non-zero, but the Relocation Data Directory Size is zero, BasePeCoffLib should only handle such case as PIC TE image.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11315 6f19259b-4bc3-4df7-8a09-765794883524
2011-02-16 01:18:28 +00:00
myronporter 58380e9c61 Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10615 6f19259b-4bc3-4df7-8a09-765794883524
2010-06-30 00:13:25 +00:00
myronporter 2fc59a003e Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10604 6f19259b-4bc3-4df7-8a09-765794883524
2010-06-25 21:56:02 +00:00
hhtian acf57deca9 Update the copyright notice format
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10412 6f19259b-4bc3-4df7-8a09-765794883524
2010-04-23 16:24:38 +00:00
mdkinney 2816e216c2 Do not update the ImageBase in the PE/COFF header if Adjust is 0.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9341 6f19259b-4bc3-4df7-8a09-765794883524
2009-10-15 17:21:22 +00:00
mdkinney 01e1171ebd Do not apply relocation fixups if the Adjust value is zero, which means the image is XIP.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9333 6f19259b-4bc3-4df7-8a09-765794883524
2009-10-08 16:45:40 +00:00
mdkinney 5cfafa075a Check to see if the section size of non-zero before failing a load operation due to a NULL base or end address
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9326 6f19259b-4bc3-4df7-8a09-765794883524
2009-10-01 23:48:00 +00:00
mdkinney acbcf0425f Fix file headers
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9189 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-24 23:39:38 +00:00
qhuang8 01a54966be Remove tabs in source code in MdePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9142 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-19 14:09:31 +00:00
qhuang8 ebd04fc2e5 Update to make end-of-line consistent for all source files in MdePkg. There are no other updates besides that change.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9141 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-19 14:02:07 +00:00
mdkinney 9101c2e894 Add ARM support
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9111 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-18 21:01:18 +00:00
eric_tian 8d579453d3 add the extra comments into BasePeCoffRelocateImage, BasePeCoffLoadImage and BasePeCoffRelocateImageForRuntime to help user to know the usage model of these APIs.
The comments mainly used to clarify it's caller's responsibility to to perform cache maintenance operations

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8283 6f19259b-4bc3-4df7-8a09-765794883524
2009-05-11 01:32:17 +00:00
lgao4 1a82ed3d0a Update BasePeCoff to Initialize the debug field to zero.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8243 6f19259b-4bc3-4df7-8a09-765794883524
2009-05-06 03:17:45 +00:00
qhuang8 50cd68dfb5 Add check for the validity of resource directory address.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8164 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-23 12:14:55 +00:00
qhuang8 b4500f6efe Add HiiResourceData field to PeCoffLib library class. PeCoffLoaderLoadImage () will set this field to HII resource data if it detects the existence in PE image. otherwise, it set that field to 0.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8141 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-22 02:04:16 +00:00
qhuang8 27b2d249d5 Remove PeRemove PeiPeCoffLoader.h and gPeiPeCoffLoaderGuid, and Add PeCoffExtraActionLib class and instances.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7811 6f19259b-4bc3-4df7-8a09-765794883524
2009-03-05 09:18:28 +00:00
mdkinney 4ab0dff338 1) Remove UEFI specific defines from IndustryStandard/PeImage.h
2) Add UEFI specific defines to Uefi/UefiBaseType.h
3) Update Base PE/COFF related libs to only use defines from IndustryStandard/PeImage.h


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7438 6f19259b-4bc3-4df7-8a09-765794883524
2009-02-05 19:30:05 +00:00
lgao4 9833a9bb6c Add check for Zero Relocation section.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7197 6f19259b-4bc3-4df7-8a09-765794883524
2009-01-07 02:02:39 +00:00
qhuang8 884c8bc047 Temporarily remove the assertions and we may find some error handling way to address potential dereference to NULL pointer.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7173 6f19259b-4bc3-4df7-8a09-765794883524
2009-01-04 03:38:23 +00:00
gikidy 03bd58dc4b Add some ASSERT()s to avoid NULL reference.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7162 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-31 07:24:49 +00:00
gikidy efb2311707 Synchronize MdePkg h files to Library/Base* c files.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6984 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-11 04:45:23 +00:00
qhuang8 030cd1a2e9 Update the text to use "x64" instead of "X64" in MdePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6854 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-05 03:23:13 +00:00
gikidy 0465a73e02 Follow the Mde_Lib_Spec to fix the function PeCoffLoaderUnloadImage() IN/OUT issue about definition and implementation.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6825 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-04 02:03:14 +00:00
qhuang8 657073df4f Add several missing assertions.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6766 6f19259b-4bc3-4df7-8a09-765794883524
2008-11-27 13:31:05 +00:00
jji4 122e219151 Function headers in .h and .c files synchronized with spec
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6731 6f19259b-4bc3-4df7-8a09-765794883524
2008-11-26 06:38:05 +00:00
klu2 1fa524e97d Fix ECC issue
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6214 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-24 06:51:40 +00:00
lgao4 3ecdcd1146 Update HobLib and PeCoffLib according to MDE Lib Spec 0.61c
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6100 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-10 06:20:50 +00:00
lgao4 2bfb60098f 1. Change 0 == Length style to Length == 0
2. Clean BasePeCoff library instance, only keep one copy PeCoffLoaderEx.c file for IA32, X64 and IPF arch
3. Clean the confused comments

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5927 6f19259b-4bc3-4df7-8a09-765794883524
2008-09-18 14:27:39 +00:00
vanjeff 1efcc4ae46 remove unnecessary comments introduced by tools from MdePkg. The regular express is "//^p//[ ]Include[ ]common[ ]header[ ]file[ ]for[ ]this[ ]module[.]^p//"
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5911 6f19259b-4bc3-4df7-8a09-765794883524
2008-09-17 07:46:17 +00:00
lgao4 19bee90c32 Correct ECC Error for MdePkg/Include/Protocol and Correct PeCofferLib bug to set ImageContext->EntryPoint after relocate when the destination address is specified.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5514 6f19259b-4bc3-4df7-8a09-765794883524
2008-07-17 08:45:10 +00:00
qhuang8 8a7d75b062 Clean up: update "EFI" to "UEFI" if applicable.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4317 6f19259b-4bc3-4df7-8a09-765794883524
2007-11-22 06:00:39 +00:00