]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/Image/Image.h
Update function description per UEFI2.3d. The main changes include:
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Image / Image.h
CommitLineData
23c98c94 1/** @file\r
504214c4 2 Data structure and functions to load and unload PeImage.\r
23c98c94 3\r
cd5ebaa0
HT
4Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials\r
28a00297 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
504214c4 13**/\r
28a00297 14\r
15\r
16#ifndef _IMAGE_H_\r
17#define _IMAGE_H_\r
18\r
f3f2e05d 19#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')\r
28a00297 20\r
21typedef struct {\r
853adefc 22 UINTN Signature;\r
23 /// Image handle\r
24 EFI_HANDLE Handle; \r
25 /// Image type\r
26 UINTN Type; \r
27 /// If entrypoint has been called\r
28 BOOLEAN Started; \r
29 /// The image's entry point\r
30 EFI_IMAGE_ENTRY_POINT EntryPoint; \r
31 /// loaded image protocol\r
32 EFI_LOADED_IMAGE_PROTOCOL Info; \r
33 /// Location in memory\r
34 EFI_PHYSICAL_ADDRESS ImageBasePage; \r
35 /// Number of pages\r
36 UINTN NumberOfPages; \r
37 /// Original fixup data\r
38 CHAR8 *FixupData; \r
39 /// Tpl of started image\r
40 EFI_TPL Tpl; \r
41 /// Status returned by started image\r
42 EFI_STATUS Status; \r
43 /// Size of ExitData from started image\r
44 UINTN ExitDataSize; \r
45 /// Pointer to exit data from started image\r
46 VOID *ExitData; \r
47 /// Pointer to pool allocation for context save/retore\r
48 VOID *JumpBuffer; \r
49 /// Pointer to buffer for context save/retore\r
50 BASE_LIBRARY_JUMP_BUFFER *JumpContext; \r
51 /// Machine type from PE image\r
52 UINT16 Machine; \r
53 /// EBC Protocol pointer\r
54 EFI_EBC_PROTOCOL *Ebc; \r
55 /// Runtime image list\r
56 EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; \r
57 /// Pointer to Loaded Image Device Path Protocl\r
58 EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; \r
59 /// PeCoffLoader ImageContext\r
60 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; \r
28a00297 61\r
62} LOADED_IMAGE_PRIVATE_DATA;\r
63\r
64#define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
65 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r
66\r
67\r
023c0fec 68#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','p','e','i')\r
69\r
70typedef struct {\r
853adefc 71 UINTN Signature;\r
72 /// Image handle\r
73 EFI_HANDLE Handle; \r
74 EFI_PE32_IMAGE_PROTOCOL Pe32Image;\r
023c0fec 75} LOAD_PE32_IMAGE_PRIVATE_DATA;\r
76\r
77#define LOAD_PE32_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
78 CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE)\r
79\r
80\r
28a00297 81//\r
82// Private Data Types\r
83//\r
f3f2e05d 84#define IMAGE_FILE_HANDLE_SIGNATURE SIGNATURE_32('i','m','g','f')\r
28a00297 85typedef struct {\r
86 UINTN Signature;\r
87 BOOLEAN FreeBuffer;\r
88 VOID *Source;\r
89 UINTN SourceSize;\r
90} IMAGE_FILE_HANDLE;\r
91\r
023c0fec 92/**\r
93 Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
94\r
95 @param This Calling context\r
96 @param ParentImageHandle The caller's image handle.\r
97 @param FilePath The specific file path from which the image is\r
98 loaded.\r
99 @param SourceBuffer If not NULL, a pointer to the memory location\r
100 containing a copy of the image to be loaded.\r
101 @param SourceSize The size in bytes of SourceBuffer.\r
102 @param DstBuffer The buffer to store the image.\r
103 @param NumberOfPages For input, specifies the space size of the\r
104 image by caller if not NULL. For output,\r
105 specifies the actual space size needed.\r
106 @param ImageHandle Image handle for output.\r
107 @param EntryPoint Image entry point for output.\r
108 @param Attribute The bit mask of attributes to set for the load\r
109 PE image.\r
110\r
111 @retval EFI_SUCCESS The image was loaded into memory.\r
112 @retval EFI_NOT_FOUND The FilePath was not found.\r
113 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
114 @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
115 path cannot be parsed to locate the proper\r
116 protocol for loading the file.\r
117 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
118 resources.\r
119\r
120**/\r
121EFI_STATUS\r
122EFIAPI\r
123CoreLoadImageEx (\r
124 IN EFI_PE32_IMAGE_PROTOCOL *This,\r
125 IN EFI_HANDLE ParentImageHandle,\r
126 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
127 IN VOID *SourceBuffer OPTIONAL,\r
128 IN UINTN SourceSize,\r
129 IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r
130 OUT UINTN *NumberOfPages OPTIONAL,\r
131 OUT EFI_HANDLE *ImageHandle,\r
132 OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r
133 IN UINT32 Attribute\r
134 );\r
135\r
136\r
137/**\r
138 Unload the specified image.\r
139\r
140 @param This Indicates the calling context.\r
141 @param ImageHandle The specified image handle.\r
162ed594 142\r
023c0fec 143 @retval EFI_INVALID_PARAMETER Image handle is NULL.\r
144 @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.\r
145 @retval EFI_SUCCESS Image successfully unloaded.\r
146\r
147**/\r
148EFI_STATUS\r
149EFIAPI\r
150CoreUnloadImageEx (\r
151 IN EFI_PE32_IMAGE_PROTOCOL *This,\r
152 IN EFI_HANDLE ImageHandle\r
153 );\r
28a00297 154#endif\r