2 Data structure and functions to load and unload PeImage.
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
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.
19 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
27 /// If entrypoint has been called
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
;
37 /// Original fixup data
39 /// Tpl of started image
41 /// Status returned by started image
43 /// Size of ExitData from started image
45 /// Pointer to exit data from started image
47 /// Pointer to pool allocation for context save/retore
49 /// Pointer to buffer for context save/retore
50 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
51 /// Machine type from PE image
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
;
62 } LOADED_IMAGE_PRIVATE_DATA
;
64 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
65 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
71 #define IMAGE_FILE_HANDLE_SIGNATURE SIGNATURE_32('i','m','g','f')
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.
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
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.
96 @retval EFI_SUCCESS Image file successfully opened.
97 @retval EFI_LOAD_ERROR If the caller passed a copy of the file, and
99 @retval EFI_INVALID_PARAMETER File path is not valid.
100 @retval EFI_NOT_FOUND File not found.
105 IN BOOLEAN BootPolicy
,
106 IN VOID
*SourceBuffer OPTIONAL
,
108 IN OUT EFI_DEVICE_PATH_PROTOCOL
**FilePath
,
109 OUT EFI_HANDLE
*DeviceHandle
,
110 IN IMAGE_FILE_HANDLE
*ImageFileHandle
,
111 OUT UINT32
*AuthenticationStatus
117 Read image file (specified by UserHandle) into user specified buffer with specified offset
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
126 @retval EFI_SUCCESS Successfully read the specified part of file
135 IN OUT UINTN
*ReadSize
,