]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/Image/Image.h
remove the gEfiLoadPeImageProtocolGuid and replace all references for it with BasePeC...
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Image / Image.h
1 /** @file
2 Data structure and functions to load and unload PeImage.
3
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15
16 #ifndef _IMAGE_H_
17 #define _IMAGE_H_
18
19 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
20
21 typedef struct {
22 UINTN Signature;
23 /// Image handle
24 EFI_HANDLE Handle;
25 /// Image type
26 UINTN Type;
27 /// If entrypoint has been called
28 BOOLEAN Started;
29 /// The image's entry point
30 EFI_IMAGE_ENTRY_POINT EntryPoint;
31 /// loaded image protocol
32 EFI_LOADED_IMAGE_PROTOCOL Info;
33 /// Location in memory
34 EFI_PHYSICAL_ADDRESS ImageBasePage;
35 /// Number of pages
36 UINTN NumberOfPages;
37 /// Original fixup data
38 CHAR8 *FixupData;
39 /// Tpl of started image
40 EFI_TPL Tpl;
41 /// Status returned by started image
42 EFI_STATUS Status;
43 /// Size of ExitData from started image
44 UINTN ExitDataSize;
45 /// Pointer to exit data from started image
46 VOID *ExitData;
47 /// Pointer to pool allocation for context save/retore
48 VOID *JumpBuffer;
49 /// Pointer to buffer for context save/retore
50 BASE_LIBRARY_JUMP_BUFFER *JumpContext;
51 /// Machine type from PE image
52 UINT16 Machine;
53 /// EBC Protocol pointer
54 EFI_EBC_PROTOCOL *Ebc;
55 /// Runtime image list
56 EFI_RUNTIME_IMAGE_ENTRY *RuntimeData;
57 /// Pointer to Loaded Image Device Path Protocl
58 EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
59 /// PeCoffLoader ImageContext
60 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
61
62 } LOADED_IMAGE_PRIVATE_DATA;
63
64 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
65 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
66
67
68 //
69 // Private Data Types
70 //
71 #define IMAGE_FILE_HANDLE_SIGNATURE SIGNATURE_32('i','m','g','f')
72 typedef struct {
73 UINTN Signature;
74 BOOLEAN FreeBuffer;
75 VOID *Source;
76 UINTN SourceSize;
77 } IMAGE_FILE_HANDLE;
78
79
80 /**
81 Opens a file for (simple) reading. The simple read abstraction
82 will access the file either from a memory copy, from a file
83 system interface, or from the load file interface.
84
85 @param BootPolicy Policy for Open Image File.
86 @param SourceBuffer Pointer to the memory location containing copy
87 of the image to be loaded.
88 @param SourceSize The size in bytes of SourceBuffer.
89 @param FilePath The specific file path from which the image is
90 loaded
91 @param DeviceHandle Pointer to the return device handle.
92 @param ImageFileHandle Pointer to the image file handle.
93 @param AuthenticationStatus Pointer to a caller-allocated UINT32 in which
94 the authentication status is returned.
95
96 @retval EFI_SUCCESS Image file successfully opened.
97 @retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
98 SourceSize is 0.
99 @retval EFI_INVALID_PARAMETER File path is not valid.
100 @retval EFI_NOT_FOUND File not found.
101
102 **/
103 EFI_STATUS
104 CoreOpenImageFile (
105 IN BOOLEAN BootPolicy,
106 IN VOID *SourceBuffer OPTIONAL,
107 IN UINTN SourceSize,
108 IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath,
109 OUT EFI_HANDLE *DeviceHandle,
110 IN IMAGE_FILE_HANDLE *ImageFileHandle,
111 OUT UINT32 *AuthenticationStatus
112 );
113
114
115
116 /**
117 Read image file (specified by UserHandle) into user specified buffer with specified offset
118 and length.
119
120 @param UserHandle Image file handle
121 @param Offset Offset to the source file
122 @param ReadSize For input, pointer of size to read; For output,
123 pointer of size actually read.
124 @param Buffer Buffer to write into
125
126 @retval EFI_SUCCESS Successfully read the specified part of file
127 into buffer.
128
129 **/
130 EFI_STATUS
131 EFIAPI
132 CoreReadImageFile (
133 IN VOID *UserHandle,
134 IN UINTN Offset,
135 IN OUT UINTN *ReadSize,
136 OUT VOID *Buffer
137 );
138
139
140
141 #endif