]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
Minor grammatical work--mostly adding periods. Items with ONLY period added did...
[mirror_edk2.git] / MdePkg / Library / BasePeCoffLib / BasePeCoffLibInternals.h
CommitLineData
d071fb19 1/** @file\r
2 Declaration of internal functions in PE/COFF Lib.\r
3\r
2fc59a00 4 Copyright (c) 2006 -2010, Intel Corporation. All rights reserved.<BR>\r
acf57dec 5 This program and the accompanying materials\r
d071fb19 6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
2fc59a00 8 http://opensource.org/licenses/bsd-license.php.\r
d071fb19 9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
d071fb19 13**/\r
14\r
15#ifndef __BASE_PECOFF_LIB_INTERNALS__\r
16#define __BASE_PECOFF_LIB_INTERNALS__\r
17\r
f734a10a
A
18#include <Base.h>\r
19#include <Library/PeCoffLib.h>\r
20#include <Library/BaseMemoryLib.h>\r
21#include <Library/DebugLib.h>\r
27b2d249 22#include <Library/PeCoffExtraActionLib.h>\r
f734a10a
A
23#include <IndustryStandard/PeImage.h>\r
24\r
25\r
d071fb19 26\r
27/**\r
28 Performs an Itanium-based specific relocation fixup and is a no-op on other\r
29 instruction sets.\r
30\r
2fc59a00 31 @param Reloc The pointer to the relocation record.\r
32 @param Fixup The pointer to the address to fix up.\r
33 @param FixupData The pointer to a buffer to log the fixups.\r
d071fb19 34 @param Adjust The offset to adjust the fixup.\r
35\r
36 @return Status code.\r
37\r
38**/\r
39RETURN_STATUS\r
40PeCoffLoaderRelocateImageEx (\r
41 IN UINT16 *Reloc,\r
42 IN OUT CHAR8 *Fixup,\r
43 IN OUT CHAR8 **FixupData,\r
44 IN UINT64 Adjust\r
45 );\r
46\r
47\r
48/**\r
49 Performs an Itanium-based specific re-relocation fixup and is a no-op on other\r
50 instruction sets. This is used to re-relocated the image into the EFI virtual\r
51 space for runtime calls.\r
52\r
2fc59a00 53 @param Reloc The pointer to the relocation record.\r
54 @param Fixup The pointer to the address to fix up.\r
55 @param FixupData The pointer to a buffer to log the fixups.\r
d071fb19 56 @param Adjust The offset to adjust the fixup.\r
57\r
58 @return Status code.\r
59\r
60**/\r
61RETURN_STATUS\r
62PeHotRelocateImageEx (\r
63 IN UINT16 *Reloc,\r
64 IN OUT CHAR8 *Fixup,\r
65 IN OUT CHAR8 **FixupData,\r
66 IN UINT64 Adjust\r
67 );\r
68\r
69\r
70/**\r
71 Returns TRUE if the machine type of PE/COFF image is supported. Supported\r
72 does not mean the image can be executed it means the PE/COFF loader supports\r
73 loading and relocating of the image type. It's up to the caller to support\r
74 the entry point.\r
75\r
76 @param Machine Machine type from the PE Header.\r
77\r
78 @return TRUE if this PE/COFF loader can load the image\r
79\r
80**/\r
81BOOLEAN\r
82PeCoffLoaderImageFormatSupported (\r
83 IN UINT16 Machine\r
84 );\r
85\r
86/**\r
87 Retrieves the magic value from the PE/COFF header.\r
88\r
89 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r
90\r
91 @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32\r
92 @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+\r
93\r
94**/\r
95UINT16\r
96PeCoffLoaderGetPeHeaderMagicValue (\r
97 IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr\r
98 );\r
99\r
100/**\r
101 Retrieves the PE or TE Header from a PE/COFF or TE image.\r
102\r
103 @param ImageContext The context of the image being loaded.\r
104 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r
105\r
106 @retval RETURN_SUCCESS The PE or TE Header is read.\r
107 @retval Other The error status from reading the PE/COFF or TE image using the ImageRead function.\r
108\r
109**/\r
110RETURN_STATUS\r
111PeCoffLoaderGetPeHeader (\r
112 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r
113 OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr\r
114 );\r
115\r
116/**\r
117 Converts an image address to the loaded address.\r
118\r
119 @param ImageContext The context of the image being loaded.\r
120 @param Address The address to be converted to the loaded address.\r
121\r
122 @return The converted address or NULL if the address can not be converted.\r
123\r
124**/\r
125VOID *\r
126PeCoffLoaderImageAddress (\r
127 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r
128 IN UINTN Address\r
129 );\r
130\r
131#endif\r