2 Declaration of internal functions in PE/COFF Lib.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __BASE_PECOFF_LIB_INTERNALS__
10 #define __BASE_PECOFF_LIB_INTERNALS__
13 #include <Library/PeCoffLib.h>
14 #include <Library/BaseMemoryLib.h>
15 #include <Library/DebugLib.h>
16 #include <Library/PeCoffExtraActionLib.h>
17 #include <IndustryStandard/PeImage.h>
22 Performs an Itanium-based specific relocation fixup and is a no-op on other
25 @param Reloc The pointer to the relocation record.
26 @param Fixup The pointer to the address to fix up.
27 @param FixupData The pointer to a buffer to log the fixups.
28 @param Adjust The offset to adjust the fixup.
34 PeCoffLoaderRelocateImageEx (
37 IN OUT CHAR8
**FixupData
,
43 Performs an Itanium-based specific re-relocation fixup and is a no-op on other
44 instruction sets. This is used to re-relocated the image into the EFI virtual
45 space for runtime calls.
47 @param Reloc The pointer to the relocation record.
48 @param Fixup The pointer to the address to fix up.
49 @param FixupData The pointer to a buffer to log the fixups.
50 @param Adjust The offset to adjust the fixup.
56 PeHotRelocateImageEx (
59 IN OUT CHAR8
**FixupData
,
65 Returns TRUE if the machine type of PE/COFF image is supported. Supported
66 does not mean the image can be executed it means the PE/COFF loader supports
67 loading and relocating of the image type. It's up to the caller to support
70 @param Machine Machine type from the PE Header.
72 @return TRUE if this PE/COFF loader can load the image
76 PeCoffLoaderImageFormatSupported (
81 Retrieves the magic value from the PE/COFF header.
83 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.
85 @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32
86 @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+
90 PeCoffLoaderGetPeHeaderMagicValue (
91 IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
95 Retrieves the PE or TE Header from a PE/COFF or TE image.
97 @param ImageContext The context of the image being loaded.
98 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.
100 @retval RETURN_SUCCESS The PE or TE Header is read.
101 @retval Other The error status from reading the PE/COFF or TE image using the ImageRead function.
105 PeCoffLoaderGetPeHeader (
106 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
,
107 OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
111 Converts an image address to the loaded address.
113 @param ImageContext The context of the image being loaded.
114 @param Address The address to be converted to the loaded address.
115 @param TeStrippedOffset Stripped offset for TE image.
117 @return The converted address or NULL if the address can not be converted.
121 PeCoffLoaderImageAddress (
122 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
,
124 IN UINTN TeStrippedOffset