#include <Protocol/MonotonicCounter.h>\r
#include <Protocol/StatusCode.h>\r
#include <Protocol/Decompress.h>\r
-#include <Protocol/LoadPe32Image.h>\r
#include <Protocol/Security.h>\r
#include <Protocol/Ebc.h>\r
#include <Protocol/Reset.h>\r
gEfiStatusCodeRuntimeProtocolGuid ## SOMETIMES_CONSUMES\r
gEfiCapsuleArchProtocolGuid ## CONSUMES\r
gEfiDecompressProtocolGuid ## CONSUMES\r
- gEfiLoadPeImageProtocolGuid ## PRODUCES\r
gEfiSimpleFileSystemProtocolGuid ## CONSUMES\r
gEfiLoadFileProtocolGuid ## CONSUMES\r
gEfiLoadFile2ProtocolGuid ## CONSUMES\r
#include "DxeMain.h"\r
#include "Image.h"\r
\r
+#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00\r
+#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01\r
+#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02\r
+\r
//\r
// Module Globals\r
//\r
LOADED_IMAGE_PRIVATE_DATA *mCurrentImage = NULL;\r
\r
-LOAD_PE32_IMAGE_PRIVATE_DATA mLoadPe32PrivateData = {\r
- LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE,\r
- NULL,\r
- {\r
- CoreLoadImageEx,\r
- CoreUnloadImageEx\r
- }\r
-};\r
-\r
\r
//\r
// This code is needed to build the Image handle for the DXE Core\r
//\r
// Export DXE Core PE Loader functionality\r
//\r
- return CoreInstallProtocolInterface (\r
- &mLoadPe32PrivateData.Handle,\r
- &gEfiLoadPeImageProtocolGuid,\r
- EFI_NATIVE_INTERFACE,\r
- &mLoadPe32PrivateData.Pe32Image\r
- );\r
+ return EFI_SUCCESS;\r
}\r
\r
\r
}\r
\r
\r
-\r
-/**\r
- Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
-\r
- @param This Calling context\r
- @param ParentImageHandle The caller's image handle.\r
- @param FilePath The specific file path from which the image is\r
- loaded.\r
- @param SourceBuffer If not NULL, a pointer to the memory location\r
- containing a copy of the image to be loaded.\r
- @param SourceSize The size in bytes of SourceBuffer.\r
- @param DstBuffer The buffer to store the image.\r
- @param NumberOfPages For input, specifies the space size of the\r
- image by caller if not NULL. For output,\r
- specifies the actual space size needed.\r
- @param ImageHandle Image handle for output.\r
- @param EntryPoint Image entry point for output.\r
- @param Attribute The bit mask of attributes to set for the load\r
- PE image.\r
-\r
- @retval EFI_SUCCESS The image was loaded into memory.\r
- @retval EFI_NOT_FOUND The FilePath was not found.\r
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
- @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
- path cannot be parsed to locate the proper\r
- protocol for loading the file.\r
- @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
- resources.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreLoadImageEx (\r
- IN EFI_PE32_IMAGE_PROTOCOL *This,\r
- IN EFI_HANDLE ParentImageHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
- IN VOID *SourceBuffer OPTIONAL,\r
- IN UINTN SourceSize,\r
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r
- OUT UINTN *NumberOfPages OPTIONAL,\r
- OUT EFI_HANDLE *ImageHandle,\r
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r
- IN UINT32 Attribute\r
- )\r
-{\r
- return CoreLoadImageCommon (\r
- TRUE,\r
- ParentImageHandle,\r
- FilePath,\r
- SourceBuffer,\r
- SourceSize,\r
- DstBuffer,\r
- NumberOfPages,\r
- ImageHandle,\r
- EntryPoint,\r
- Attribute\r
- );\r
-}\r
-\r
-\r
/**\r
Transfer control to a loaded image's entry point.\r
\r
return Status;\r
}\r
\r
-\r
-\r
-/**\r
- Unload the specified image.\r
-\r
- @param This Indicates the calling context.\r
- @param ImageHandle The specified image handle.\r
-\r
- @retval EFI_INVALID_PARAMETER Image handle is NULL.\r
- @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.\r
- @retval EFI_SUCCESS Image successfully unloaded.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreUnloadImageEx (\r
- IN EFI_PE32_IMAGE_PROTOCOL *This,\r
- IN EFI_HANDLE ImageHandle\r
- )\r
-{\r
- return CoreUnloadImage (ImageHandle);\r
-}\r
CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r
\r
\r
-#define LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','p','e','i')\r
-\r
-typedef struct {\r
- UINTN Signature;\r
- /// Image handle\r
- EFI_HANDLE Handle; \r
- EFI_PE32_IMAGE_PROTOCOL Pe32Image;\r
-} LOAD_PE32_IMAGE_PRIVATE_DATA;\r
-\r
-#define LOAD_PE32_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
- CR(a, LOAD_PE32_IMAGE_PRIVATE_DATA, Pe32Image, LOAD_PE32_IMAGE_PRIVATE_DATA_SIGNATURE)\r
-\r
-\r
//\r
// Private Data Types\r
//\r
);\r
\r
\r
-/**\r
- Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
-\r
- @param This Calling context\r
- @param ParentImageHandle The caller's image handle.\r
- @param FilePath The specific file path from which the image is\r
- loaded.\r
- @param SourceBuffer If not NULL, a pointer to the memory location\r
- containing a copy of the image to be loaded.\r
- @param SourceSize The size in bytes of SourceBuffer.\r
- @param DstBuffer The buffer to store the image.\r
- @param NumberOfPages For input, specifies the space size of the\r
- image by caller if not NULL. For output,\r
- specifies the actual space size needed.\r
- @param ImageHandle Image handle for output.\r
- @param EntryPoint Image entry point for output.\r
- @param Attribute The bit mask of attributes to set for the load\r
- PE image.\r
-\r
- @retval EFI_SUCCESS The image was loaded into memory.\r
- @retval EFI_NOT_FOUND The FilePath was not found.\r
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
- @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
- path cannot be parsed to locate the proper\r
- protocol for loading the file.\r
- @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
- resources.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreLoadImageEx (\r
- IN EFI_PE32_IMAGE_PROTOCOL *This,\r
- IN EFI_HANDLE ParentImageHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
- IN VOID *SourceBuffer OPTIONAL,\r
- IN UINTN SourceSize,\r
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r
- OUT UINTN *NumberOfPages OPTIONAL,\r
- OUT EFI_HANDLE *ImageHandle,\r
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r
- IN UINT32 Attribute\r
- );\r
-\r
-\r
-/**\r
- Unload the specified image.\r
-\r
- @param This Indicates the calling context.\r
- @param ImageHandle The specified image handle.\r
\r
- @retval EFI_INVALID_PARAMETER Image handle is NULL.\r
- @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.\r
- @retval EFI_SUCCESS Image successfully unloaded.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-CoreUnloadImageEx (\r
- IN EFI_PE32_IMAGE_PROTOCOL *This,\r
- IN EFI_HANDLE ImageHandle\r
- );\r
#endif\r
+++ /dev/null
-/** @file\r
-\r
- Load Pe32 Image protocol provides capability to load and unload EFI image into memory and execute it.\r
- This protocol bases on File Device Path to get EFI image.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __LOAD_PE32_IMAGE_H__\r
-#define __LOAD_PE32_IMAGE_H__\r
-\r
-#define PE32_IMAGE_PROTOCOL_GUID \\r
- {0x5cb5c776,0x60d5,0x45ee,{0x88,0x3c,0x45,0x27,0x8,0xcd,0x74,0x3f }}\r
-\r
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE 0x00\r
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION 0x01\r
-#define EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION 0x02\r
-\r
-typedef struct _EFI_PE32_IMAGE_PROTOCOL EFI_PE32_IMAGE_PROTOCOL;\r
-\r
-/**\r
-\r
- Loads an EFI image into memory and returns a handle to the image with extended parameters.\r
-\r
- @param This Pointer to the LoadPe32Image protocol instance\r
- @param ParentImageHandle The caller's image handle.\r
- @param FilePath The specific file path from which the image is loaded.\r
- @param SourceBuffer If not NULL, a pointer to the memory location containing a copy of\r
- the image to be loaded.\r
- @param SourceSize The size in bytes of SourceBuffer.\r
- @param DstBuffer The buffer to store the image.\r
- @param NumberOfPages For input, specifies the space size of the image by caller if not NULL.\r
- For output, specifies the actual space size needed.\r
- @param ImageHandle Image handle for output.\r
- @param EntryPoint Image entry point for output.\r
- @param Attribute The bit mask of attributes to set for the load PE image.\r
-\r
- @retval EFI_SUCCESS The image was loaded into memory.\r
- @retval EFI_NOT_FOUND The FilePath was not found.\r
- @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
- @retval EFI_UNSUPPORTED The image type is not supported, or the device path cannot be\r
- parsed to locate the proper protocol for loading the file.\r
- @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient memory resources.\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *LOAD_PE_IMAGE)(\r
- IN EFI_PE32_IMAGE_PROTOCOL *This,\r
- IN EFI_HANDLE ParentImageHandle,\r
- IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
- IN VOID *SourceBuffer OPTIONAL,\r
- IN UINTN SourceSize,\r
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,\r
- OUT UINTN *NumberOfPages OPTIONAL,\r
- OUT EFI_HANDLE *ImageHandle,\r
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,\r
- IN UINT32 Attribute\r
- );\r
-\r
-/**\r
-\r
- Unload the specified image.\r
-\r
- @param This Pointer to the LoadPe32Image protocol instance\r
- @param ImageHandle The specified image handle to be unloaded.\r
-\r
- @retval EFI_INVALID_PARAMETER Image handle is NULL.\r
- @retval EFI_UNSUPPORTED Attempt to unload an unsupported image.\r
- @retval EFI_SUCCESS Image is successfully unloaded.\r
-\r
---*/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *UNLOAD_PE_IMAGE)(\r
- IN EFI_PE32_IMAGE_PROTOCOL *This,\r
- IN EFI_HANDLE ImageHandle\r
- );\r
-\r
-struct _EFI_PE32_IMAGE_PROTOCOL {\r
- LOAD_PE_IMAGE LoadPeImage;\r
- UNLOAD_PE_IMAGE UnLoadPeImage;\r
-};\r
-\r
-extern EFI_GUID gEfiLoadPeImageProtocolGuid;\r
-\r
-#endif\r
-\r
gEfiCrc32GuidedSectionExtractionGuid = { 0xFC1BCDB0, 0x7D31, 0x49aa, {0x93, 0x6A, 0xA4, 0x60, 0x0D, 0x9D, 0xD0, 0x83 } }\r
\r
[Protocols.common] \r
- ## Load File protocol provides capability to load and unload EFI image into memory and execute it.\r
- ## Include/Protocol/LoadPe32Image.h\r
- gEfiLoadPeImageProtocolGuid = { 0x5CB5C776, 0x60D5, 0x45EE, { 0x88, 0x3C, 0x45, 0x27, 0x08, 0xCD, 0x74, 0x3F }}\r
- \r
## Print protocol defines six basic print functions to print the format unicode and ascii string.\r
## Include/Protocol/Print2.h\r
gEfiPrint2ProtocolGuid = { 0x5bcc3dbc, 0x8c57, 0x450a, { 0xbb, 0x0c, 0xa1, 0xc0, 0xbd, 0xde, 0x48, 0x0c }}\r