]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
Make MDE package pass intel IPF compiler with /W4 /WX switched on.
[mirror_edk2.git] / MdePkg / Library / BasePeCoffLib / BasePeCoffLibInternals.h
1 /** @file
2 Declaration of internal functions in PE/COFF Lib.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: BasePeCoffLibInternals.h
14
15 **/
16
17 #ifndef __BASE_PECOFF_LIB_INTERNALS__
18 #define __BASE_PECOFF_LIB_INTERNALS__
19
20 /**
21 Performs an Itanium-based specific relocation fixup and is a no-op on other
22 instruction sets.
23
24 @param Reloc Pointer to the relocation record.
25 @param Fixup Pointer to the address to fix up.
26 @param FixupData Pointer to a buffer to log the fixups.
27 @param Adjust The offset to adjust the fixup.
28
29 @return Status code.
30
31 **/
32 RETURN_STATUS
33 PeCoffLoaderRelocateImageEx (
34 IN UINT16 *Reloc,
35 IN OUT CHAR8 *Fixup,
36 IN OUT CHAR8 **FixupData,
37 IN UINT64 Adjust
38 );
39
40
41 /**
42 Performs an Itanium-based specific re-relocation fixup and is a no-op on other
43 instruction sets. This is used to re-relocated the image into the EFI virtual
44 space for runtime calls.
45
46 @param Reloc Pointer to the relocation record.
47 @param Fixup Pointer to the address to fix up.
48 @param FixupData Pointer to a buffer to log the fixups.
49 @param Adjust The offset to adjust the fixup.
50
51 @return Status code.
52
53 **/
54 RETURN_STATUS
55 PeHotRelocateImageEx (
56 IN UINT16 *Reloc,
57 IN OUT CHAR8 *Fixup,
58 IN OUT CHAR8 **FixupData,
59 IN UINT64 Adjust
60 );
61
62
63 /**
64 Returns TRUE if the machine type of PE/COFF image is supported. Supported
65 does not mean the image can be executed it means the PE/COFF loader supports
66 loading and relocating of the image type. It's up to the caller to support
67 the entry point.
68
69 @param Machine Machine type from the PE Header.
70
71 @return TRUE if this PE/COFF loader can load the image
72
73 **/
74 BOOLEAN
75 PeCoffLoaderImageFormatSupported (
76 IN UINT16 Machine
77 );
78
79 /**
80 Retrieves the magic value from the PE/COFF header.
81
82 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.
83
84 @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32
85 @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+
86
87 **/
88 UINT16
89 PeCoffLoaderGetPeHeaderMagicValue (
90 IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
91 );
92
93 /**
94 Retrieves the PE or TE Header from a PE/COFF or TE image.
95
96 @param ImageContext The context of the image being loaded.
97 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.
98
99 @retval RETURN_SUCCESS The PE or TE Header is read.
100 @retval Other The error status from reading the PE/COFF or TE image using the ImageRead function.
101
102 **/
103 RETURN_STATUS
104 PeCoffLoaderGetPeHeader (
105 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
106 OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
107 );
108
109 /**
110 Converts an image address to the loaded address.
111
112 @param ImageContext The context of the image being loaded.
113 @param Address The address to be converted to the loaded address.
114
115 @return The converted address or NULL if the address can not be converted.
116
117 **/
118 VOID *
119 PeCoffLoaderImageAddress (
120 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
121 IN UINTN Address
122 );
123
124 #endif