]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePeCoffLib/x64/PeCoffLoaderEx.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BasePeCoffLib / x64 / PeCoffLoaderEx.c
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12
13 Module Name:
14
15 PeCoffLoaderEx.c
16
17 Abstract:
18
19 x64 Specific relocation fixups.
20
21 --*/
22
23 #include "BasePeCoffLibInternals.h"
24
25
26 /**
27 Performs an x64 specific relocation fixup.
28
29 @param Reloc Pointer to the relocation record
30 @param Fixup Pointer to the address to fix up
31 @param FixupData Pointer to a buffer to log the fixups
32 @param Adjust The offset to adjust the fixup
33
34 @retval RETURN_SUCCESS Success to perform relocation
35 @retval RETURN_UNSUPPORTED Unsupported.
36 **/
37 RETURN_STATUS
38 GluePeCoffLoaderRelocateImageEx (
39 IN UINT16 *Reloc,
40 IN OUT CHAR8 *Fixup,
41 IN OUT CHAR8 **FixupData,
42 IN UINT64 Adjust
43 )
44 {
45 return RETURN_UNSUPPORTED;
46 }
47
48 /**
49 Returns TRUE if the machine type of PE/COFF image is supported. Supported
50 does not mean the image can be executed it means the PE/COFF loader supports
51 loading and relocating of the image type. It's up to the caller to support
52 the entry point.
53
54 This function implies the basic PE/COFF loader/relocator supports IA32, EBC,
55 & X64 images. Calling the entry point in a correct mannor is up to the
56 consumer of this library.
57
58 @param Machine Machine type from the PE Header.
59
60 @return TRUE if this PE/COFF loader can load the image
61
62 **/
63 BOOLEAN
64 PeCoffLoaderImageFormatSupported (
65 IN UINT16 Machine
66 )
67 {
68 if ((Machine == EFI_IMAGE_MACHINE_IA32) || (Machine == EFI_IMAGE_MACHINE_X64) ||
69 (Machine == EFI_IMAGE_MACHINE_EBC)) {
70 return TRUE;
71 }
72
73 return FALSE;
74 }
75
76
77 /**
78 Performs an X64 specific re-relocation fixup and is a no-op on other
79 instruction sets. This is used to re-relocated the image into the EFI virtual
80 space for runtime calls.
81
82 @param Reloc Pointer to the relocation record.
83 @param Fixup Pointer to the address to fix up.
84 @param FixupData Pointer to a buffer to log the fixups.
85 @param Adjust The offset to adjust the fixup.
86
87 @return Status code.
88
89 **/
90 RETURN_STATUS
91 GluePeHotRelocateImageEx (
92 IN UINT16 *Reloc,
93 IN OUT CHAR8 *Fixup,
94 IN OUT CHAR8 **FixupData,
95 IN UINT64 Adjust
96 )
97 {
98 return RETURN_UNSUPPORTED;
99 }