1 | /* $Id: PeCoffLoaderEx.c 56292 2015-06-09 14:20:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * PeCoffLoaderEx.c
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2015 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | /*
|
---|
28 | This code is based on:
|
---|
29 |
|
---|
30 | Specific relocation fixups for none Itanium architecture.
|
---|
31 |
|
---|
32 | Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
---|
33 | All rights reserved. This program and the accompanying materials
|
---|
34 | are licensed and made available under the terms and conditions of the BSD License
|
---|
35 | which accompanies this distribution. The full text of the license may be found at
|
---|
36 | http://opensource.org/licenses/bsd-license.php
|
---|
37 |
|
---|
38 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
39 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
40 |
|
---|
41 | */
|
---|
42 |
|
---|
43 | #include "BasePeCoffLibInternals.h"
|
---|
44 |
|
---|
45 |
|
---|
46 | /**
|
---|
47 | Performs an Itanium-based specific relocation fixup and is a no-op on other
|
---|
48 | instruction sets.
|
---|
49 |
|
---|
50 | @param Reloc Pointer to the relocation record.
|
---|
51 | @param Fixup Pointer to the address to fix up.
|
---|
52 | @param FixupData Pointer to a buffer to log the fixups.
|
---|
53 | @param Adjust The offset to adjust the fixup.
|
---|
54 |
|
---|
55 | @return Status code.
|
---|
56 |
|
---|
57 | **/
|
---|
58 | RETURN_STATUS
|
---|
59 | PeCoffLoaderRelocateImageEx (
|
---|
60 | IN UINT16 *Reloc,
|
---|
61 | IN OUT CHAR8 *Fixup,
|
---|
62 | IN OUT CHAR8 **FixupData,
|
---|
63 | IN UINT64 Adjust
|
---|
64 | )
|
---|
65 | {
|
---|
66 | return RETURN_UNSUPPORTED;
|
---|
67 | }
|
---|
68 |
|
---|
69 | /**
|
---|
70 | Returns TRUE if the machine type of PE/COFF image is supported. Supported
|
---|
71 | does not mean the image can be executed it means the PE/COFF loader supports
|
---|
72 | loading and relocating of the image type. It's up to the caller to support
|
---|
73 | the entry point.
|
---|
74 |
|
---|
75 | The IA32/X64 version PE/COFF loader/relocater both support IA32, X64 and EBC images.
|
---|
76 |
|
---|
77 | @param Machine Machine type from the PE Header.
|
---|
78 |
|
---|
79 | @return TRUE if this PE/COFF loader can load the image
|
---|
80 |
|
---|
81 | **/
|
---|
82 | BOOLEAN
|
---|
83 | PeCoffLoaderImageFormatSupported (
|
---|
84 | IN UINT16 Machine
|
---|
85 | )
|
---|
86 | {
|
---|
87 | if ((Machine == IMAGE_FILE_MACHINE_I386) || (Machine == IMAGE_FILE_MACHINE_X64) ||
|
---|
88 | (Machine == IMAGE_FILE_MACHINE_EBC)) {
|
---|
89 | return TRUE;
|
---|
90 | }
|
---|
91 |
|
---|
92 | return FALSE;
|
---|
93 | }
|
---|
94 |
|
---|
95 | /**
|
---|
96 | Performs an Itanium-based specific re-relocation fixup and is a no-op on other
|
---|
97 | instruction sets. This is used to re-relocated the image into the EFI virtual
|
---|
98 | space for runtime calls.
|
---|
99 |
|
---|
100 | @param Reloc Pointer to the relocation record.
|
---|
101 | @param Fixup Pointer to the address to fix up.
|
---|
102 | @param FixupData Pointer to a buffer to log the fixups.
|
---|
103 | @param Adjust The offset to adjust the fixup.
|
---|
104 |
|
---|
105 | @return Status code.
|
---|
106 |
|
---|
107 | **/
|
---|
108 | RETURN_STATUS
|
---|
109 | PeHotRelocateImageEx (
|
---|
110 | IN UINT16 *Reloc,
|
---|
111 | IN OUT CHAR8 *Fixup,
|
---|
112 | IN OUT CHAR8 **FixupData,
|
---|
113 | IN UINT64 Adjust
|
---|
114 | )
|
---|
115 | {
|
---|
116 | return RETURN_UNSUPPORTED;
|
---|
117 | }
|
---|
118 |
|
---|