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