VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h@ 99404

最後變更 在這個檔案從99404是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.8 KB
 
1/** @file
2 Declaration of internal functions in PE/COFF Lib.
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#ifndef __BASE_PECOFF_LIB_INTERNALS__
11#define __BASE_PECOFF_LIB_INTERNALS__
12
13#include <Base.h>
14#include <Library/PeCoffLib.h>
15#include <Library/BaseMemoryLib.h>
16#include <Library/DebugLib.h>
17#include <Library/PeCoffExtraActionLib.h>
18#include <IndustryStandard/PeImage.h>
19
20//
21// Macro definitions for RISC-V architecture.
22//
23#define RV_X(x, s, n) (((x) >> (s)) & ((1<<(n))-1))
24#define RISCV_IMM_BITS 12
25#define RISCV_IMM_REACH (1LL<<RISCV_IMM_BITS)
26#define RISCV_CONST_HIGH_PART(VALUE) \
27 (((VALUE) + (RISCV_IMM_REACH/2)) & ~(RISCV_IMM_REACH-1))
28
29/**
30 Performs an Itanium-based specific relocation fixup and is a no-op on other
31 instruction sets.
32
33 @param Reloc The pointer to the relocation record.
34 @param Fixup The pointer to the address to fix up.
35 @param FixupData The pointer to a buffer to log the fixups.
36 @param Adjust The offset to adjust the fixup.
37
38 @return Status code.
39
40**/
41RETURN_STATUS
42PeCoffLoaderRelocateImageEx (
43 IN UINT16 *Reloc,
44 IN OUT CHAR8 *Fixup,
45 IN OUT CHAR8 **FixupData,
46 IN UINT64 Adjust
47 );
48
49/**
50 Performs an Itanium-based specific re-relocation fixup and is a no-op on other
51 instruction sets. This is used to re-relocated the image into the EFI virtual
52 space for runtime calls.
53
54 @param Reloc The pointer to the relocation record.
55 @param Fixup The pointer to the address to fix up.
56 @param FixupData The pointer to a buffer to log the fixups.
57 @param Adjust The offset to adjust the fixup.
58
59 @return Status code.
60
61**/
62RETURN_STATUS
63PeHotRelocateImageEx (
64 IN UINT16 *Reloc,
65 IN OUT CHAR8 *Fixup,
66 IN OUT CHAR8 **FixupData,
67 IN UINT64 Adjust
68 );
69
70/**
71 Returns TRUE if the machine type of PE/COFF image is supported. Supported
72 does not mean the image can be executed it means the PE/COFF loader supports
73 loading and relocating of the image type. It's up to the caller to support
74 the entry point.
75
76 @param Machine Machine type from the PE Header.
77
78 @return TRUE if this PE/COFF loader can load the image
79
80**/
81BOOLEAN
82PeCoffLoaderImageFormatSupported (
83 IN UINT16 Machine
84 );
85
86/**
87 Retrieves the magic value from the PE/COFF header.
88
89 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.
90
91 @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32
92 @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+
93
94**/
95UINT16
96PeCoffLoaderGetPeHeaderMagicValue (
97 IN EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
98 );
99
100/**
101 Retrieves the PE or TE Header from a PE/COFF or TE image.
102
103 @param ImageContext The context of the image being loaded.
104 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.
105
106 @retval RETURN_SUCCESS The PE or TE Header is read.
107 @retval Other The error status from reading the PE/COFF or TE image using the ImageRead function.
108
109**/
110RETURN_STATUS
111PeCoffLoaderGetPeHeader (
112 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
113 OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
114 );
115
116/**
117 Converts an image address to the loaded address.
118
119 @param ImageContext The context of the image being loaded.
120 @param Address The address to be converted to the loaded address.
121 @param TeStrippedOffset Stripped offset for TE image.
122
123 @return The converted address or NULL if the address can not be converted.
124
125**/
126VOID *
127PeCoffLoaderImageAddress (
128 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
129 IN UINTN Address,
130 IN UINTN TeStrippedOffset
131 );
132
133#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette