]>
Commit | Line | Data |
---|---|---|
d071fb19 | 1 | /** @file\r |
2 | Declaration of internal functions in PE/COFF Lib.\r | |
3 | \r | |
d4b6dd93 | 4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
d071fb19 | 6 | \r |
d071fb19 | 7 | **/\r |
8 | \r | |
9 | #ifndef __BASE_PECOFF_LIB_INTERNALS__\r | |
10 | #define __BASE_PECOFF_LIB_INTERNALS__\r | |
11 | \r | |
f734a10a A |
12 | #include <Base.h>\r |
13 | #include <Library/PeCoffLib.h>\r | |
14 | #include <Library/BaseMemoryLib.h>\r | |
15 | #include <Library/DebugLib.h>\r | |
27b2d249 | 16 | #include <Library/PeCoffExtraActionLib.h>\r |
f734a10a A |
17 | #include <IndustryStandard/PeImage.h>\r |
18 | \r | |
19 | \r | |
d071fb19 | 20 | \r |
21 | /**\r | |
22 | Performs an Itanium-based specific relocation fixup and is a no-op on other\r | |
23 | instruction sets.\r | |
24 | \r | |
2fc59a00 | 25 | @param Reloc The pointer to the relocation record.\r |
26 | @param Fixup The pointer to the address to fix up.\r | |
27 | @param FixupData The pointer to a buffer to log the fixups.\r | |
d071fb19 | 28 | @param Adjust The offset to adjust the fixup.\r |
29 | \r | |
30 | @return Status code.\r | |
31 | \r | |
32 | **/\r | |
33 | RETURN_STATUS\r | |
34 | PeCoffLoaderRelocateImageEx (\r | |
35 | IN UINT16 *Reloc,\r | |
36 | IN OUT CHAR8 *Fixup,\r | |
37 | IN OUT CHAR8 **FixupData,\r | |
38 | IN UINT64 Adjust\r | |
39 | );\r | |
40 | \r | |
41 | \r | |
42 | /**\r | |
43 | Performs an Itanium-based specific re-relocation fixup and is a no-op on other\r | |
44 | instruction sets. This is used to re-relocated the image into the EFI virtual\r | |
45 | space for runtime calls.\r | |
46 | \r | |
2fc59a00 | 47 | @param Reloc The pointer to the relocation record.\r |
48 | @param Fixup The pointer to the address to fix up.\r | |
49 | @param FixupData The pointer to a buffer to log the fixups.\r | |
d071fb19 | 50 | @param Adjust The offset to adjust the fixup.\r |
51 | \r | |
52 | @return Status code.\r | |
53 | \r | |
54 | **/\r | |
55 | RETURN_STATUS\r | |
56 | PeHotRelocateImageEx (\r | |
57 | IN UINT16 *Reloc,\r | |
58 | IN OUT CHAR8 *Fixup,\r | |
59 | IN OUT CHAR8 **FixupData,\r | |
60 | IN UINT64 Adjust\r | |
61 | );\r | |
62 | \r | |
63 | \r | |
64 | /**\r | |
65 | Returns TRUE if the machine type of PE/COFF image is supported. Supported\r | |
66 | does not mean the image can be executed it means the PE/COFF loader supports\r | |
67 | loading and relocating of the image type. It's up to the caller to support\r | |
68 | the entry point.\r | |
69 | \r | |
70 | @param Machine Machine type from the PE Header.\r | |
71 | \r | |
72 | @return TRUE if this PE/COFF loader can load the image\r | |
73 | \r | |
74 | **/\r | |
75 | BOOLEAN\r | |
76 | PeCoffLoaderImageFormatSupported (\r | |
77 | IN UINT16 Machine\r | |
78 | );\r | |
79 | \r | |
80 | /**\r | |
81 | Retrieves the magic value from the PE/COFF header.\r | |
82 | \r | |
83 | @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r | |
84 | \r | |
85 | @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32\r | |
86 | @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+\r | |
87 | \r | |
88 | **/\r | |
89 | UINT16\r | |
90 | PeCoffLoaderGetPeHeaderMagicValue (\r | |
91 | IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr\r | |
92 | );\r | |
93 | \r | |
94 | /**\r | |
95 | Retrieves the PE or TE Header from a PE/COFF or TE image.\r | |
96 | \r | |
97 | @param ImageContext The context of the image being loaded.\r | |
98 | @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r | |
99 | \r | |
100 | @retval RETURN_SUCCESS The PE or TE Header is read.\r | |
101 | @retval Other The error status from reading the PE/COFF or TE image using the ImageRead function.\r | |
102 | \r | |
103 | **/\r | |
104 | RETURN_STATUS\r | |
105 | PeCoffLoaderGetPeHeader (\r | |
106 | IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r | |
107 | OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr\r | |
108 | );\r | |
109 | \r | |
110 | /**\r | |
111 | Converts an image address to the loaded address.\r | |
112 | \r | |
bf29dc16 ED |
113 | @param ImageContext The context of the image being loaded.\r |
114 | @param Address The address to be converted to the loaded address.\r | |
115 | @param TeStrippedOffset Stripped offset for TE image.\r | |
d071fb19 | 116 | \r |
117 | @return The converted address or NULL if the address can not be converted.\r | |
118 | \r | |
119 | **/\r | |
120 | VOID *\r | |
121 | PeCoffLoaderImageAddress (\r | |
122 | IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,\r | |
bf29dc16 ED |
123 | IN UINTN Address,\r |
124 | IN UINTN TeStrippedOffset\r | |
d071fb19 | 125 | );\r |
126 | \r | |
127 | #endif\r |