summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-15 11:13:40 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-15 11:13:40 +0000
commit5b664244561a6d697d1814e7c525cc6013863caf (patch)
treedfb7e5435cf6ce0431d735368aa2e3d81c1528a9 /MdePkg
parent591ee27e8495b232e4b68d9df90c4a478a00f991 (diff)
downloadedk2-platforms-5b664244561a6d697d1814e7c525cc6013863caf.tar.xz
Correct TeImage file format and Clean up PeiRebase tool to remove unused code and only relocate image.
Move two EFI_DEP_REPLACE_TRUE and DEPEX_STACK_SIZE_INCREMENT macros from MdePkg to EdkModule/DxeMain module, because these two macros are specific implementation, not defined in spec. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2249 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/Common/Dependency.h15
-rw-r--r--MdePkg/Include/Common/FirmwareFileSystem.h7
-rw-r--r--MdePkg/Include/Common/FirmwareVolumeHeader.h7
-rw-r--r--MdePkg/Library/BasePeCoffLib/BasePeCoff.c7
4 files changed, 15 insertions, 21 deletions
diff --git a/MdePkg/Include/Common/Dependency.h b/MdePkg/Include/Common/Dependency.h
index d82cefd958..b38dcd5477 100644
--- a/MdePkg/Include/Common/Dependency.h
+++ b/MdePkg/Include/Common/Dependency.h
@@ -12,6 +12,9 @@
Module Name: Dependency.h
+ @par Revision Reference:
+ These definitions are from DxeCis 0.91 spec.
+
**/
#ifndef __DEPENDENCY_H__
@@ -34,16 +37,4 @@
/// EFI_DEP_SOR - If present, this must be the first opcode
#define EFI_DEP_SOR 0x09
-///
-/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
-/// to save time. A EFI_DEP_PUSH is evauated one an
-/// replaced with EFI_DEP_REPLACE_TRUE
-///
-#define EFI_DEP_REPLACE_TRUE 0xff
-
-///
-/// Define the initial size of the dependency expression evaluation stack
-///
-#define DEPEX_STACK_SIZE_INCREMENT 0x1000
-
#endif
diff --git a/MdePkg/Include/Common/FirmwareFileSystem.h b/MdePkg/Include/Common/FirmwareFileSystem.h
index 5678a95524..00ce8faff1 100644
--- a/MdePkg/Include/Common/FirmwareFileSystem.h
+++ b/MdePkg/Include/Common/FirmwareFileSystem.h
@@ -60,13 +60,6 @@
EFI_FILE_HEADER_INVALID \
)
-#define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
- ( \
- (BOOLEAN) ( \
- (FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit) \
- ) \
- )
-
typedef UINT16 EFI_FFS_FILE_TAIL;
///
diff --git a/MdePkg/Include/Common/FirmwareVolumeHeader.h b/MdePkg/Include/Common/FirmwareVolumeHeader.h
index 038dce6f7f..c2bbddf3e9 100644
--- a/MdePkg/Include/Common/FirmwareVolumeHeader.h
+++ b/MdePkg/Include/Common/FirmwareVolumeHeader.h
@@ -70,6 +70,13 @@ typedef UINT32 EFI_FVB_ATTRIBUTES;
EFI_FVB_LOCK_CAP \
)
+#define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
+ ( \
+ (BOOLEAN) ( \
+ (FvbAttributes & EFI_FVB_ERASE_POLARITY) ? (((~TestAttributes) & Bit) == Bit) : ((TestAttributes & Bit) == Bit) \
+ ) \
+ )
+
#define EFI_FVB_STATUS (EFI_FVB_READ_STATUS | EFI_FVB_WRITE_STATUS | EFI_FVB_LOCK_STATUS)
///
diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
index ad9c627727..f16ea90ffa 100644
--- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
+++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c
@@ -299,7 +299,7 @@ PeCoffLoaderGetImageInfo (
ImageContext->ImageAddress = Hdr.Pe32Plus->OptionalHeader.ImageBase;
}
} else {
- ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase);
+ ImageContext->ImageAddress = (PHYSICAL_ADDRESS)(Hdr.Te->ImageBase + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize);
}
//
@@ -598,8 +598,11 @@ PeCoffLoaderRelocateImage (
//
if (ImageContext->DestinationAddress != 0) {
BaseAddress = ImageContext->DestinationAddress;
- } else {
+ } else if (!(ImageContext->IsTeImage)) {
BaseAddress = ImageContext->ImageAddress;
+ } else {
+ Hdr.Te = (EFI_TE_IMAGE_HEADER *)(UINTN)(ImageContext->ImageAddress);
+ BaseAddress = ImageContext->ImageAddress + sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize;
}
if (!(ImageContext->IsTeImage)) {