]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePeCoffLib/x64/PeCoffLoaderEx.c
The EFI_IMAGE_REL_BASED_DIR64 type has been in switch for all common relocation type...
[mirror_edk2.git] / MdePkg / Library / BasePeCoffLib / x64 / PeCoffLoaderEx.c
1 /** @file
2 x64 Specific relocation fixups.
3
4 Copyright (c) 2005 - 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 **/
14
15 /**
16 Performs an x64 specific relocation fixup.
17
18 @param Reloc Pointer to the relocation record
19 @param Fixup Pointer to the address to fix up
20 @param FixupData Pointer to a buffer to log the fixups
21 @param Adjust The offset to adjust the fixup
22
23 @retval RETURN_SUCCESS Success to perform relocation
24 @retval RETURN_UNSUPPORTED Unsupported.
25 **/
26 RETURN_STATUS
27 PeCoffLoaderRelocateImageEx (
28 IN UINT16 *Reloc,
29 IN OUT CHAR8 *Fixup,
30 IN OUT CHAR8 **FixupData,
31 IN UINT64 Adjust
32 )
33 {
34 return RETURN_UNSUPPORTED;
35 }
36
37 /**
38 Returns TRUE if the machine type of PE/COFF image is supported. Supported
39 does not mean the image can be executed it means the PE/COFF loader supports
40 loading and relocating of the image type. It's up to the caller to support
41 the entry point.
42
43 This function implies the basic PE/COFF loader/relocator supports IA32, EBC,
44 & X64 images. Calling the entry point in a correct mannor is up to the
45 consumer of this library.
46
47 @param Machine Machine type from the PE Header.
48
49 @return TRUE if this PE/COFF loader can load the image
50
51 **/
52 BOOLEAN
53 PeCoffLoaderImageFormatSupported (
54 IN UINT16 Machine
55 )
56 {
57 if ((Machine == EFI_IMAGE_MACHINE_IA32) || (Machine == EFI_IMAGE_MACHINE_X64) ||
58 (Machine == EFI_IMAGE_MACHINE_EBC)) {
59 return TRUE;
60 }
61
62 return FALSE;
63 }
64
65
66 /**
67 Performs an X64 specific re-relocation fixup and is a no-op on other
68 instruction sets. This is used to re-relocated the image into the EFI virtual
69 space for runtime calls.
70
71 @param Reloc Pointer to the relocation record.
72 @param Fixup Pointer to the address to fix up.
73 @param FixupData Pointer to a buffer to log the fixups.
74 @param Adjust The offset to adjust the fixup.
75
76 @return Status code.
77
78 **/
79 RETURN_STATUS
80 PeHotRelocateImageEx (
81 IN UINT16 *Reloc,
82 IN OUT CHAR8 *Fixup,
83 IN OUT CHAR8 **FixupData,
84 IN UINT64 Adjust
85 )
86 {
87 return RETURN_UNSUPPORTED;
88 }