]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Common/PeCoffLib.h
BaseTools: Various typo
[mirror_edk2.git] / BaseTools / Source / C / Common / PeCoffLib.h
index fc2e4cafc942517f4f82a42d586bc5f288f25cb7..c250471192356f3b87eac7874e3a7503d94745fb 100644 (file)
@@ -1,16 +1,14 @@
 /** @file\r
-       Function prototypes and defines on Memory Only PE COFF loader\r
+  Function prototypes and defines on Memory Only PE COFF loader\r
 \r
-       Copyright (c) 2006, 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
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  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
-       Module Name:    PeCoffLib.h\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
@@ -22,7 +20,7 @@
 // BUGBUG: Find where used and see if can be replaced by RETURN_STATUS codes\r
 //\r
 #define IMAGE_ERROR_SUCCESS                      0\r
-#define IMAGE_ERROR_IMAGE_READ                   1  \r
+#define IMAGE_ERROR_IMAGE_READ                   1\r
 #define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE  2\r
 #define IMAGE_ERROR_INVALID_MACHINE_TYPE         3\r
 #define IMAGE_ERROR_INVALID_SUBSYSTEM            4\r
@@ -75,15 +73,15 @@ typedef struct {
 \r
 \r
 /**\r
-       Retrieves information on a PE/COFF image\r
+  Retrieves information on a PE/COFF image\r
 \r
-       @param  ImageContext The context of the image being loaded\r
+  @param  ImageContext The context of the image being loaded\r
 \r
-       @retval EFI_SUCCESS The information on the PE/COFF image was collected.\r
-       @retval EFI_INVALID_PARAMETER ImageContext is NULL.\r
-       @retval EFI_UNSUPPORTED The PE/COFF image is not supported.\r
-       @retval Otherwise The error status from reading the PE/COFF image using the\r
-       ImageContext->ImageRead() function\r
+  @retval  EFI_SUCCESS The information on the PE/COFF image was collected.\r
+  @retval  EFI_INVALID_PARAMETER ImageContext is NULL.\r
+  @retval  EFI_UNSUPPORTED The PE/COFF image is not supported.\r
+  @retval  Otherwise The error status from reading the PE/COFF image using the\r
+  ImageContext->ImageRead() function\r
 \r
 **/\r
 RETURN_STATUS\r
@@ -94,13 +92,13 @@ PeCoffLoaderGetImageInfo (
 ;\r
 \r
 /**\r
-       Relocates a PE/COFF image in memory\r
+  Relocates a PE/COFF image in memory\r
 \r
-       @param  ImageContext Contains information on the loaded image to relocate\r
+  @param  ImageContext Contains information on the loaded image to relocate\r
 \r
-       @retval EFI_SUCCESS      if the PE/COFF image was relocated\r
-       @retval EFI_LOAD_ERROR   if the image is not a valid PE/COFF image\r
-       @retval EFI_UNSUPPORTED  not support\r
+  @retval EFI_SUCCESS      if the PE/COFF image was relocated\r
+  @retval EFI_LOAD_ERROR   if the image is not a valid PE/COFF image\r
+  @retval EFI_UNSUPPORTED  not support\r
 \r
 **/\r
 RETURN_STATUS\r
@@ -111,14 +109,14 @@ PeCoffLoaderRelocateImage (
 ;\r
 \r
 /**\r
-       Loads a PE/COFF image into memory\r
+  Loads a PE/COFF image into memory\r
 \r
-       @param  ImageContext Contains information on image to load into memory\r
+  @param  ImageContext Contains information on image to load into memory\r
 \r
-       @retval EFI_SUCCESS            if the PE/COFF image was loaded\r
-       @retval EFI_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer\r
-       @retval EFI_LOAD_ERROR         if the image is a runtime driver with no relocations\r
-       @retval EFI_INVALID_PARAMETER  if the image address is invalid\r
+  @retval EFI_SUCCESS            if the PE/COFF image was loaded\r
+  @retval EFI_BUFFER_TOO_SMALL   if the caller did not provide a large enough buffer\r
+  @retval EFI_LOAD_ERROR         if the image is a runtime driver with no relocations\r
+  @retval EFI_INVALID_PARAMETER  if the image address is invalid\r
 \r
 **/\r
 RETURN_STATUS\r
@@ -134,4 +132,79 @@ PeCoffLoaderGetPdbPointer (
   IN VOID  *Pe32Data\r
   )\r
 ;\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+PeCoffLoaderGetEntryPoint (\r
+  IN  VOID  *Pe32Data,\r
+  OUT VOID  **EntryPoint,\r
+  OUT VOID  **BaseOfImage\r
+  )\r
+;\r
+\r
+//\r
+// These functions are used by the ARM PE/COFF relocation code and by\r
+// the ELF to PE/COFF converter so that is why they are public\r
+//\r
+\r
+/**\r
+  Pass in a pointer to an ARM MOVT or MOVW immediate instruction and\r
+  return the immediate data encoded in the instruction\r
+\r
+  @param  Instruction   Pointer to ARM MOVT or MOVW immediate instruction\r
+\r
+  @return Immediate address encoded in the instruction\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+ThumbMovtImmediateAddress (\r
+  IN UINT16 *Instruction\r
+  );\r
+\r
+/**\r
+  Update an ARM MOVT or MOVW immediate instruction immediate data.\r
+\r
+  @param  Instruction   Pointer to ARM MOVT or MOVW immediate instruction\r
+  @param  Address       New address to patch into the instruction\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ThumbMovtImmediatePatch (\r
+  IN OUT UINT16 *Instruction,\r
+  IN     UINT16 Address\r
+  );\r
+\r
+\r
+/**\r
+  Pass in a pointer to an ARM MOVW/MOVT instruction pair and\r
+  return the immediate data encoded in the two` instruction\r
+\r
+  @param  Instructions  Pointer to ARM MOVW/MOVT instruction pair\r
+\r
+  @return Immediate address encoded in the instructions\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+ThumbMovwMovtImmediateAddress (\r
+  IN UINT16 *Instructions\r
+  );\r
+\r
+/**\r
+  Update an ARM MOVW/MOVT immediate instruction instruction pair.\r
+\r
+  @param  Instructions  Pointer to ARM MOVW/MOVT instruction pair\r
+  @param  Address       New address to patch into the instructions\r
+**/\r
+VOID\r
+EFIAPI\r
+ThumbMovwMovtImmediatePatch (\r
+  IN OUT UINT16 *Instructions,\r
+  IN     UINT32 Address\r
+  );\r
+\r
+\r
+\r
 #endif\r