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