]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/CodeTools/TianoTools/PeCoffLoader/X64/PeCoffLoaderEx.c
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / CodeTools / TianoTools / PeCoffLoader / X64 / PeCoffLoaderEx.c
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright 2005, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 PeCoffLoaderEx.c\r
16\r
17Abstract:\r
18\r
19 x64 Specific relocation fixups\r
20\r
21Revision History\r
22\r
23--*/\r
24\r
ce53a8c3 25#include <Common/UefiBaseTypes.h>\r
26#include <Common/EfiImage.h>\r
878ddf1f 27#include <Library/PeCoffLib.h>\r
878ddf1f 28\r
29\r
30\r
31\r
32RETURN_STATUS\r
33PeCoffLoaderRelocateImageEx (\r
34 IN UINT16 *Reloc,\r
35 IN OUT CHAR8 *Fixup, \r
36 IN OUT CHAR8 **FixupData,\r
37 IN UINT64 Adjust\r
38 )\r
39/*++\r
40\r
41Routine Description:\r
42 Performs an x64 specific relocation fixup\r
43\r
44Arguments:\r
45 Reloc - Pointer to the relocation record\r
46 Fixup - Pointer to the address to fix up\r
47 FixupData - Pointer to a buffer to log the fixups\r
48 Adjust - The offset to adjust the fixup\r
49\r
50Returns:\r
51 None\r
52\r
53--*/\r
54{\r
55 UINT64 *F64;\r
56\r
57 switch ((*Reloc) >> 12) {\r
58\r
59 case EFI_IMAGE_REL_BASED_DIR64:\r
60 F64 = (UINT64 *) Fixup;\r
61 *F64 = *F64 + (UINT64) Adjust;\r
62 if (*FixupData != NULL) {\r
63 *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));\r
64 *(UINT64 *)(*FixupData) = *F64;\r
65 *FixupData = *FixupData + sizeof(UINT64);\r
66 }\r
67 break;\r
68\r
69 default:\r
70 return RETURN_UNSUPPORTED;\r
71 }\r
72\r
73 return RETURN_SUCCESS;\r
74}\r