]>
Commit | Line | Data |
---|---|---|
265c22cc | 1 | /**@file\r |
2 | x64 Specific relocation fixups.\r | |
878ddf1f | 3 | \r |
265c22cc | 4 | Copyright (c) 2005 - 2006 Intel Corporation. <BR>\r |
878ddf1f | 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 | |
265c22cc | 13 | **/\r |
878ddf1f | 14 | \r |
ce53a8c3 | 15 | #include <Common/UefiBaseTypes.h>\r |
16 | #include <Common/EfiImage.h>\r | |
878ddf1f | 17 | #include <Library/PeCoffLib.h>\r |
878ddf1f | 18 | \r |
265c22cc | 19 | /**\r |
20 | Performs an x64 specific relocation fixup\r | |
878ddf1f | 21 | \r |
265c22cc | 22 | @param Reloc Pointer to the relocation record\r |
23 | @param Fixup Pointer to the address to fix up\r | |
24 | @param FixupData Pointer to a buffer to log the fixups\r | |
25 | @param Adjust The offset to adjust the fixup\r | |
26 | \r | |
27 | @retval RETURN_SUCCESS Success to perform relocation\r | |
28 | @retval RETURN_UNSUPPORTED Unsupported.\r | |
29 | **/\r | |
878ddf1f | 30 | RETURN_STATUS\r |
31 | PeCoffLoaderRelocateImageEx (\r | |
265c22cc | 32 | IN UINT16 *Reloc,\r |
33 | IN OUT CHAR8 *Fixup, \r | |
34 | IN OUT CHAR8 **FixupData,\r | |
35 | IN UINT64 Adjust\r | |
878ddf1f | 36 | )\r |
878ddf1f | 37 | {\r |
38 | UINT64 *F64;\r | |
39 | \r | |
40 | switch ((*Reloc) >> 12) {\r | |
41 | \r | |
42 | case EFI_IMAGE_REL_BASED_DIR64:\r | |
43 | F64 = (UINT64 *) Fixup;\r | |
44 | *F64 = *F64 + (UINT64) Adjust;\r | |
45 | if (*FixupData != NULL) {\r | |
46 | *FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));\r | |
47 | *(UINT64 *)(*FixupData) = *F64;\r | |
48 | *FixupData = *FixupData + sizeof(UINT64);\r | |
49 | }\r | |
50 | break;\r | |
51 | \r | |
52 | default:\r | |
53 | return RETURN_UNSUPPORTED;\r | |
54 | }\r | |
55 | \r | |
56 | return RETURN_SUCCESS;\r | |
57 | }\r |