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