Initial import.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
1019
MdePkg/Library/BasePeCoffLib/BasePeCoff.c
Normal file
1019
MdePkg/Library/BasePeCoffLib/BasePeCoff.c
Normal file
File diff suppressed because it is too large
Load Diff
30
MdePkg/Library/BasePeCoffLib/BasePeCoffLib.mbd
Normal file
30
MdePkg/Library/BasePeCoffLib/BasePeCoffLib.mbd
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
-->
|
||||
<LibraryModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MbdLibHeader>
|
||||
<BaseName>BasePeCoffLib</BaseName>
|
||||
<Guid>556f5d10-7309-4af4-b80a-8196bd60946f</Guid>
|
||||
<Version>0</Version>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004 - 2005, Intel Corporation</Copyright>
|
||||
<License>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
</License>
|
||||
<Created>2006-03-09 23:16</Created>
|
||||
<Modified>2006-03-19 15:17</Modified>
|
||||
</MbdLibHeader>
|
||||
</LibraryModuleBuildDescription>
|
56
MdePkg/Library/BasePeCoffLib/BasePeCoffLib.msa
Normal file
56
MdePkg/Library/BasePeCoffLib/BasePeCoffLib.msa
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
-->
|
||||
<LibraryModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
|
||||
<MsaLibHeader>
|
||||
<BaseName>BasePeCoffLib</BaseName>
|
||||
<ModuleType>BASE</ModuleType>
|
||||
<ComponentType>LIBRARY</ComponentType>
|
||||
<Guid>556f5d10-7309-4af4-b80a-8196bd60946f</Guid>
|
||||
<Version>0</Version>
|
||||
<Abstract>Component description file for the PEI library.</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2004 - 2005, Intel Corporation</Copyright>
|
||||
<License>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
</License>
|
||||
<Specification>0</Specification>
|
||||
<Created>2006-03-09 23:16</Created>
|
||||
<Updated>2006-03-19 15:17</Updated>
|
||||
</MsaLibHeader>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_PRODUCED">PeCoffLib</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">BaseMemoryLib</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>BasePeCoff.c</Filename>
|
||||
<Arch ArchType="IA32">
|
||||
<Filename>ia32\PeCoffLoaderEx.c</Filename>
|
||||
</Arch>
|
||||
<Arch ArchType="X64">
|
||||
<Filename>x64\PeCoffLoaderEx.c</Filename>
|
||||
</Arch>
|
||||
<Arch ArchType="IPF">
|
||||
<Filename>ipf\PeCoffLoaderEx.c</Filename>
|
||||
</Arch>
|
||||
<Arch ArchType="EBC">
|
||||
<Filename>ebc\PeCoffLoaderEx.c</Filename>
|
||||
</Arch>
|
||||
</SourceFiles>
|
||||
<Includes>
|
||||
<PackageName>MdePkg</PackageName>
|
||||
</Includes>
|
||||
</LibraryModuleSurfaceArea>
|
43
MdePkg/Library/BasePeCoffLib/Ebc/PeCoffLoaderEx.c
Normal file
43
MdePkg/Library/BasePeCoffLib/Ebc/PeCoffLoaderEx.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/** @file
|
||||
EBC Specific relocation fixups.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeCoffLoaderEx.c
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Performs an IA-32 specific relocation fixup.
|
||||
|
||||
@param Reloc Pointer to the relocation record.
|
||||
|
||||
@param Fixup Pointer to the address to fix up.
|
||||
|
||||
@param FixupData Pointer to a buffer to log the fixups.
|
||||
|
||||
@param Adjust The offset to adjust the fixup.
|
||||
|
||||
@retval EFI_UNSUPPORTED Unsupported now.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
PeCoffLoaderRelocateImageEx (
|
||||
IN UINT16 *Reloc,
|
||||
IN OUT CHAR8 *Fixup,
|
||||
IN OUT CHAR8 **FixupData,
|
||||
IN UINT64 Adjust
|
||||
)
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
44
MdePkg/Library/BasePeCoffLib/Ia32/PeCoffLoaderEx.c
Normal file
44
MdePkg/Library/BasePeCoffLib/Ia32/PeCoffLoaderEx.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/** @file
|
||||
IA-32 Specific relocation fixups.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeCoffLoaderEx.c
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Performs an IA-32 specific relocation fixup.
|
||||
|
||||
@param Reloc Pointer to the relocation record.
|
||||
|
||||
@param Fixup Pointer to the address to fix up.
|
||||
|
||||
@param FixupData Pointer to a buffer to log the fixups.
|
||||
|
||||
@param Adjust The offset to adjust the fixup.
|
||||
|
||||
@retval EFI_UNSUPPORTED Unsupported now.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
PeCoffLoaderRelocateImageEx (
|
||||
IN UINT16 *Reloc,
|
||||
IN OUT CHAR8 *Fixup,
|
||||
IN OUT CHAR8 **FixupData,
|
||||
IN UINT64 Adjust
|
||||
)
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
230
MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c
Normal file
230
MdePkg/Library/BasePeCoffLib/Ipf/PeCoffLoaderEx.c
Normal file
@@ -0,0 +1,230 @@
|
||||
/** @file
|
||||
Fixes Intel Itanium(TM) specific relocation types.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeCoffLoaderEx.c
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) \
|
||||
Value |= (((UINT64)((*(Address) >> InstPos) & (((UINT64)1 << Size) - 1))) << ValPos)
|
||||
|
||||
#define INS_IMM64(Value, Address, Size, InstPos, ValPos) \
|
||||
*(UINT32*)Address = (*(UINT32*)Address & ~(((1 << Size) - 1) << InstPos)) | \
|
||||
((UINT32)((((UINT64)Value >> ValPos) & (((UINT64)1 << Size) - 1))) << InstPos)
|
||||
|
||||
#define IMM64_IMM7B_INST_WORD_X 3
|
||||
#define IMM64_IMM7B_SIZE_X 7
|
||||
#define IMM64_IMM7B_INST_WORD_POS_X 4
|
||||
#define IMM64_IMM7B_VAL_POS_X 0
|
||||
|
||||
#define IMM64_IMM9D_INST_WORD_X 3
|
||||
#define IMM64_IMM9D_SIZE_X 9
|
||||
#define IMM64_IMM9D_INST_WORD_POS_X 18
|
||||
#define IMM64_IMM9D_VAL_POS_X 7
|
||||
|
||||
#define IMM64_IMM5C_INST_WORD_X 3
|
||||
#define IMM64_IMM5C_SIZE_X 5
|
||||
#define IMM64_IMM5C_INST_WORD_POS_X 13
|
||||
#define IMM64_IMM5C_VAL_POS_X 16
|
||||
|
||||
#define IMM64_IC_INST_WORD_X 3
|
||||
#define IMM64_IC_SIZE_X 1
|
||||
#define IMM64_IC_INST_WORD_POS_X 12
|
||||
#define IMM64_IC_VAL_POS_X 21
|
||||
|
||||
#define IMM64_IMM41a_INST_WORD_X 1
|
||||
#define IMM64_IMM41a_SIZE_X 10
|
||||
#define IMM64_IMM41a_INST_WORD_POS_X 14
|
||||
#define IMM64_IMM41a_VAL_POS_X 22
|
||||
|
||||
#define IMM64_IMM41b_INST_WORD_X 1
|
||||
#define IMM64_IMM41b_SIZE_X 8
|
||||
#define IMM64_IMM41b_INST_WORD_POS_X 24
|
||||
#define IMM64_IMM41b_VAL_POS_X 32
|
||||
|
||||
#define IMM64_IMM41c_INST_WORD_X 2
|
||||
#define IMM64_IMM41c_SIZE_X 23
|
||||
#define IMM64_IMM41c_INST_WORD_POS_X 0
|
||||
#define IMM64_IMM41c_VAL_POS_X 40
|
||||
|
||||
#define IMM64_SIGN_INST_WORD_X 3
|
||||
#define IMM64_SIGN_SIZE_X 1
|
||||
#define IMM64_SIGN_INST_WORD_POS_X 27
|
||||
#define IMM64_SIGN_VAL_POS_X 63
|
||||
|
||||
/**
|
||||
Performs an Itanium-based specific relocation fixup.
|
||||
|
||||
@param Reloc Pointer to the relocation record.
|
||||
|
||||
@param Fixup Pointer to the address to fix up.
|
||||
|
||||
@param FixupData Pointer to a buffer to log the fixups.
|
||||
|
||||
@param Adjust The offset to adjust the fixup.
|
||||
|
||||
@return Status code.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
PeCoffLoaderRelocateImageEx (
|
||||
IN UINT16 *Reloc,
|
||||
IN OUT CHAR8 *Fixup,
|
||||
IN OUT CHAR8 **FixupData,
|
||||
IN UINT64 Adjust
|
||||
)
|
||||
{
|
||||
UINT64 *F64;
|
||||
UINT64 FixupVal;
|
||||
|
||||
switch ((*Reloc) >> 12) {
|
||||
|
||||
case EFI_IMAGE_REL_BASED_DIR64:
|
||||
F64 = (UINT64 *) Fixup;
|
||||
*F64 = *F64 + (UINT64) Adjust;
|
||||
if (*FixupData != NULL) {
|
||||
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
|
||||
*(UINT64 *)(*FixupData) = *F64;
|
||||
*FixupData = *FixupData + sizeof(UINT64);
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IMAGE_REL_BASED_IA64_IMM64:
|
||||
|
||||
//
|
||||
// Align it to bundle address before fixing up the
|
||||
// 64-bit immediate value of the movl instruction.
|
||||
//
|
||||
|
||||
Fixup = (CHAR8 *)((UINTN) Fixup & (UINTN) ~(15));
|
||||
FixupVal = (UINT64)0;
|
||||
|
||||
//
|
||||
// Extract the lower 32 bits of IMM64 from bundle
|
||||
//
|
||||
EXT_IMM64(FixupVal,
|
||||
(UINT32 *)Fixup + IMM64_IMM7B_INST_WORD_X,
|
||||
IMM64_IMM7B_SIZE_X,
|
||||
IMM64_IMM7B_INST_WORD_POS_X,
|
||||
IMM64_IMM7B_VAL_POS_X
|
||||
);
|
||||
|
||||
EXT_IMM64(FixupVal,
|
||||
(UINT32 *)Fixup + IMM64_IMM9D_INST_WORD_X,
|
||||
IMM64_IMM9D_SIZE_X,
|
||||
IMM64_IMM9D_INST_WORD_POS_X,
|
||||
IMM64_IMM9D_VAL_POS_X
|
||||
);
|
||||
|
||||
EXT_IMM64(FixupVal,
|
||||
(UINT32 *)Fixup + IMM64_IMM5C_INST_WORD_X,
|
||||
IMM64_IMM5C_SIZE_X,
|
||||
IMM64_IMM5C_INST_WORD_POS_X,
|
||||
IMM64_IMM5C_VAL_POS_X
|
||||
);
|
||||
|
||||
EXT_IMM64(FixupVal,
|
||||
(UINT32 *)Fixup + IMM64_IC_INST_WORD_X,
|
||||
IMM64_IC_SIZE_X,
|
||||
IMM64_IC_INST_WORD_POS_X,
|
||||
IMM64_IC_VAL_POS_X
|
||||
);
|
||||
|
||||
EXT_IMM64(FixupVal,
|
||||
(UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X,
|
||||
IMM64_IMM41a_SIZE_X,
|
||||
IMM64_IMM41a_INST_WORD_POS_X,
|
||||
IMM64_IMM41a_VAL_POS_X
|
||||
);
|
||||
|
||||
//
|
||||
// Update 64-bit address
|
||||
//
|
||||
FixupVal += Adjust;
|
||||
|
||||
//
|
||||
// Insert IMM64 into bundle
|
||||
//
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_IMM7B_INST_WORD_X),
|
||||
IMM64_IMM7B_SIZE_X,
|
||||
IMM64_IMM7B_INST_WORD_POS_X,
|
||||
IMM64_IMM7B_VAL_POS_X
|
||||
);
|
||||
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_IMM9D_INST_WORD_X),
|
||||
IMM64_IMM9D_SIZE_X,
|
||||
IMM64_IMM9D_INST_WORD_POS_X,
|
||||
IMM64_IMM9D_VAL_POS_X
|
||||
);
|
||||
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_IMM5C_INST_WORD_X),
|
||||
IMM64_IMM5C_SIZE_X,
|
||||
IMM64_IMM5C_INST_WORD_POS_X,
|
||||
IMM64_IMM5C_VAL_POS_X
|
||||
);
|
||||
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_IC_INST_WORD_X),
|
||||
IMM64_IC_SIZE_X,
|
||||
IMM64_IC_INST_WORD_POS_X,
|
||||
IMM64_IC_VAL_POS_X
|
||||
);
|
||||
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_IMM41a_INST_WORD_X),
|
||||
IMM64_IMM41a_SIZE_X,
|
||||
IMM64_IMM41a_INST_WORD_POS_X,
|
||||
IMM64_IMM41a_VAL_POS_X
|
||||
);
|
||||
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_IMM41b_INST_WORD_X),
|
||||
IMM64_IMM41b_SIZE_X,
|
||||
IMM64_IMM41b_INST_WORD_POS_X,
|
||||
IMM64_IMM41b_VAL_POS_X
|
||||
);
|
||||
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_IMM41c_INST_WORD_X),
|
||||
IMM64_IMM41c_SIZE_X,
|
||||
IMM64_IMM41c_INST_WORD_POS_X,
|
||||
IMM64_IMM41c_VAL_POS_X
|
||||
);
|
||||
|
||||
INS_IMM64(FixupVal,
|
||||
((UINT32 *)Fixup + IMM64_SIGN_INST_WORD_X),
|
||||
IMM64_SIGN_SIZE_X,
|
||||
IMM64_SIGN_INST_WORD_POS_X,
|
||||
IMM64_SIGN_VAL_POS_X
|
||||
);
|
||||
|
||||
F64 = (UINT64 *) Fixup;
|
||||
if (*FixupData != NULL) {
|
||||
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
|
||||
*(UINT64 *)(*FixupData) = *F64;
|
||||
*FixupData = *FixupData + sizeof(UINT64);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
47
MdePkg/Library/BasePeCoffLib/build.xml
Normal file
47
MdePkg/Library/BasePeCoffLib/build.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
||||
<project basedir="." default="BasePeCoffLib"><!--Apply external ANT tasks-->
|
||||
<taskdef resource="GenBuild.tasks"/>
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
|
||||
<import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
|
||||
<property name="MODULE_RELATIVE_PATH" value="Library\BasePeCoffLib"/>
|
||||
<property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
|
||||
<property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
|
||||
<target name="BasePeCoffLib">
|
||||
<GenBuild baseName="BasePeCoffLib" mbdFilename="${MODULE_DIR}\BasePeCoffLib.mbd" msaFilename="${MODULE_DIR}\BasePeCoffLib.msa"/>
|
||||
</target>
|
||||
<target depends="BasePeCoffLib_clean" name="clean"/>
|
||||
<target depends="BasePeCoffLib_cleanall" name="cleanall"/>
|
||||
<target name="BasePeCoffLib_clean">
|
||||
<OutputDirSetup baseName="BasePeCoffLib" mbdFilename="${MODULE_DIR}\BasePeCoffLib.mbd" msaFilename="${MODULE_DIR}\BasePeCoffLib.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\BasePeCoffLib_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\BasePeCoffLib_build.xml" target="clean"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
|
||||
</target>
|
||||
<target name="BasePeCoffLib_cleanall">
|
||||
<OutputDirSetup baseName="BasePeCoffLib" mbdFilename="${MODULE_DIR}\BasePeCoffLib.mbd" msaFilename="${MODULE_DIR}\BasePeCoffLib.msa"/>
|
||||
<if>
|
||||
<available file="${DEST_DIR_OUTPUT}\BasePeCoffLib_build.xml"/>
|
||||
<then>
|
||||
<ant antfile="${DEST_DIR_OUTPUT}\BasePeCoffLib_build.xml" target="cleanall"/>
|
||||
</then>
|
||||
</if>
|
||||
<delete dir="${DEST_DIR_OUTPUT}"/>
|
||||
<delete dir="${DEST_DIR_DEBUG}"/>
|
||||
<delete>
|
||||
<fileset dir="${BIN_DIR}" includes="**BasePeCoffLib*"/>
|
||||
</delete>
|
||||
</target>
|
||||
</project>
|
56
MdePkg/Library/BasePeCoffLib/x64/PeCoffLoaderEx.c
Normal file
56
MdePkg/Library/BasePeCoffLib/x64/PeCoffLoaderEx.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/** @file
|
||||
x64 Specific relocation fixups.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
Module Name: PeCoffLoaderEx.c
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Performs an x64 specific relocation fixup.
|
||||
|
||||
@param Reloc Pointer to the relocation record
|
||||
@param Fixup Pointer to the address to fix up
|
||||
@param FixupData Pointer to a buffer to log the fixups
|
||||
@param Adjust The offset to adjust the fixup
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
PeCoffLoaderRelocateImageEx (
|
||||
IN UINT16 *Reloc,
|
||||
IN OUT CHAR8 *Fixup,
|
||||
IN OUT CHAR8 **FixupData,
|
||||
IN UINT64 Adjust
|
||||
)
|
||||
{
|
||||
UINT64 *F64;
|
||||
|
||||
switch ((*Reloc) >> 12) {
|
||||
|
||||
case EFI_IMAGE_REL_BASED_DIR64:
|
||||
F64 = (UINT64 *) Fixup;
|
||||
*F64 = *F64 + (UINT64) Adjust;
|
||||
if (*FixupData != NULL) {
|
||||
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
|
||||
*(UINT64 *)(*FixupData) = *F64;
|
||||
*FixupData = *FixupData + sizeof(UINT64);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
Reference in New Issue
Block a user