]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Guid/PeiPeCoffLoader.h
Add comments and DoxyGen format for these files.
[mirror_edk2.git] / MdeModulePkg / Include / Guid / PeiPeCoffLoader.h
index 95ee3542778e9aae842af307f66de386c37ea743..eaca8e6f234465bd82c312046385ddcdb4fc8013 100644 (file)
@@ -1,21 +1,17 @@
-/*++\r
+/** @file\r
+  \r
+  GUID for the PE/COFF Loader APIs shared between SEC, PEI and DXE\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation                                                         \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
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.               \r
 \r
-Module Name:\r
-    PeiPeCoffLoader.h\r
-    \r
-Abstract:\r
-  GUID for the PE/COFF Loader APIs shared between PEI and DXE\r
-\r
---*/\r
+**/\r
 \r
 #ifndef __PEI_PE_COFF_LOADER_H__\r
 #define __PEI_PE_COFF_LOADER_H__\r
@@ -30,30 +26,107 @@ Abstract:
 \r
 typedef struct _EFI_PEI_PE_COFF_LOADER_PROTOCOL   EFI_PEI_PE_COFF_LOADER_PROTOCOL;\r
 \r
+/**\r
+  Retrieves information about a PE/COFF image.\r
+\r
+  Computes the PeCoffHeaderOffset, ImageAddress, ImageSize, DestinationAddress, CodeView,\r
+  PdbPointer, RelocationsStripped, SectionAlignment, SizeOfHeaders, and DebugDirectoryEntryRva\r
+  fields of the ImageContext structure.  If ImageContext is NULL, then return RETURN_INVALID_PARAMETER.\r
+  If the PE/COFF image accessed through the ImageRead service in the ImageContext structure is not\r
+  a supported PE/COFF image type, then return RETURN_UNSUPPORTED.  If any errors occur while\r
+  computing the fields of ImageContext, then the error status is returned in the ImageError field of\r
+  ImageContext. \r
+\r
+  @param  This                      Pointer to the EFI_PEI_PE_COFF_LOADER_PROTOCOL instance.\r
+  @param  ImageContext              Pointer to the image context structure that describes the PE/COFF\r
+                                    image that needs to be examined by this function.\r
+\r
+  @retval RETURN_SUCCESS            The information on the PE/COFF image was collected.\r
+  @retval RETURN_INVALID_PARAMETER  ImageContext is NULL.\r
+  @retval RETURN_UNSUPPORTED        The PE/COFF image is not supported.\r
 \r
+**/\r
 typedef \r
-EFI_STATUS\r
+RETURN_STATUS\r
 (EFIAPI *EFI_PEI_PE_COFF_LOADER_GET_IMAGE_INFO) (\r
   IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,\r
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext\r
   );\r
 \r
+/**\r
+  Loads a PE/COFF image into memory.\r
+\r
+  Loads the PE/COFF image accessed through the ImageRead service of ImageContext into the buffer\r
+  specified by the ImageAddress and ImageSize fields of ImageContext.  The caller must allocate\r
+  the load buffer and fill in the ImageAddress and ImageSize fields prior to calling this function.\r
+  The EntryPoint, FixupDataSize, CodeView, and PdbPointer fields of ImageContext are computed.\r
+  If ImageContext is NULL, then ASSERT().\r
+\r
+  @param  This                      Pointer to the EFI_PEI_PE_COFF_LOADER_PROTOCOL instance.\r
+  @param  ImageContext              Pointer to the image context structure that describes the PE/COFF\r
+                                    image that is being loaded.\r
+\r
+  @retval RETURN_SUCCESS            The PE/COFF image was loaded into the buffer specified by\r
+                                    the ImageAddress and ImageSize fields of ImageContext.\r
+                                    Extended status information is in the ImageError field of ImageContext.\r
+  @retval RETURN_BUFFER_TOO_SMALL   The caller did not provide a large enough buffer.\r
+                                    Extended status information is in the ImageError field of ImageContext.\r
+  @retval RETURN_LOAD_ERROR         The PE/COFF image is an EFI Runtime image with no relocations.\r
+                                    Extended status information is in the ImageError field of ImageContext.\r
+  @retval RETURN_INVALID_PARAMETER  The image address is invalid.\r
+                                    Extended status information is in the ImageError field of ImageContext.\r
+\r
+**/\r
 typedef \r
-EFI_STATUS\r
+RETURN_STATUS\r
 (EFIAPI *EFI_PEI_PE_COFF_LOADER_LOAD_IMAGE) (\r
   IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,\r
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext\r
   );\r
 \r
+/**\r
+  Applies relocation fixups to a PE/COFF image that was loaded with PeCoffLoaderLoadImage().\r
+\r
+  If the DestinationAddress field of ImageContext is 0, then use the ImageAddress field of\r
+  ImageContext as the relocation base address.  Otherwise, use the DestinationAddress field\r
+  of ImageContext as the relocation base address.  The caller must allocate the relocation\r
+  fixup log buffer and fill in the FixupData field of ImageContext prior to calling this function.  \r
+  If ImageContext is NULL, then ASSERT().\r
+\r
+  @param  This                Pointer to the EFI_PEI_PE_COFF_LOADER_PROTOCOL instance.\r
+  @param  ImageContext        Pointer to the image context structure that describes the PE/COFF\r
+                              image that is being relocated.\r
+\r
+  @retval RETURN_SUCCESS      The PE/COFF image was relocated.\r
+                              Extended status information is in the ImageError field of ImageContext.\r
+  @retval RETURN_LOAD_ERROR   The image in not a valid PE/COFF image.\r
+                              Extended status information is in the ImageError field of ImageContext.\r
+  @retval RETURN_UNSUPPORTED  A relocation record type is not supported.\r
+                              Extended status information is in the ImageError field of ImageContext.\r
+\r
+**/\r
 typedef \r
-EFI_STATUS\r
+RETURN_STATUS\r
 (EFIAPI *EFI_PEI_PE_COFF_LOADER_RELOCATE_IMAGE) (\r
   IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,\r
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext\r
   );\r
 \r
+/**\r
+  Unloads a loaded PE/COFF image from memory and releases its taken resource.\r
+   \r
+  For NT32 emulator, the PE/COFF image loaded by system needs to release.\r
+  For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded, \r
+  this function can simply return RETURN_SUCCESS.\r
+\r
+  @param  This                      Pointer to the EFI_PEI_PE_COFF_LOADER_PROTOCOL instance.\r
+  @param  ImageContext              Pointer to the image context structure that describes the PE/COFF\r
+                                    image to be unloaded.\r
+\r
+  @retval RETURN_SUCCESS            The PE/COFF image was unloaded successfully.\r
+**/\r
 typedef \r
-EFI_STATUS\r
+RETURN_STATUS\r
 (EFIAPI *EFI_PEI_PE_COFF_LOADER_UNLOAD_IMAGE) (\r
   IN EFI_PEI_PE_COFF_LOADER_PROTOCOL          *This,\r
   IN PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext\r