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