]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Library / BasePeCoffLib / BasePeCoffLibInternals.h
diff --git a/OldMdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h b/OldMdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
new file mode 100644 (file)
index 0000000..3d4d71a
--- /dev/null
@@ -0,0 +1,124 @@
+/** @file\r
+  Declaration of internal functions in PE/COFF Lib.\r
+\r
+  Copyright (c) 2006, Intel Corporation<BR>\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
+  Module Name:  BasePeCoffLibInternals.h\r
+\r
+**/\r
+\r
+#ifndef __BASE_PECOFF_LIB_INTERNALS__\r
+#define __BASE_PECOFF_LIB_INTERNALS__\r
+\r
+/**\r
+  Performs an Itanium-based specific relocation fixup and is a no-op on other\r
+  instruction sets.\r
+\r
+  @param  Reloc       Pointer to the relocation record.\r
+  @param  Fixup       Pointer to the address to fix up.\r
+  @param  FixupData   Pointer to a buffer to log the fixups.\r
+  @param  Adjust      The offset to adjust the fixup.\r
+\r
+  @return Status code.\r
+\r
+**/\r
+RETURN_STATUS\r
+PeCoffLoaderRelocateImageEx (\r
+  IN UINT16      *Reloc,\r
+  IN OUT CHAR8   *Fixup,\r
+  IN OUT CHAR8   **FixupData,\r
+  IN UINT64      Adjust\r
+  );\r
+\r
+\r
+/**\r
+  Performs an Itanium-based specific re-relocation fixup and is a no-op on other\r
+  instruction sets. This is used to re-relocated the image into the EFI virtual\r
+  space for runtime calls.\r
+\r
+  @param  Reloc       Pointer to the relocation record.\r
+  @param  Fixup       Pointer to the address to fix up.\r
+  @param  FixupData   Pointer to a buffer to log the fixups.\r
+  @param  Adjust      The offset to adjust the fixup.\r
+\r
+  @return Status code.\r
+\r
+**/\r
+RETURN_STATUS\r
+PeHotRelocateImageEx (\r
+  IN UINT16      *Reloc,\r
+  IN OUT CHAR8   *Fixup,\r
+  IN OUT CHAR8   **FixupData,\r
+  IN UINT64      Adjust\r
+  );\r
+\r
+\r
+/**\r
+  Returns TRUE if the machine type of PE/COFF image is supported. Supported\r
+  does not mean the image can be executed it means the PE/COFF loader supports\r
+  loading and relocating of the image type. It's up to the caller to support\r
+  the entry point.\r
+\r
+  @param  Machine   Machine type from the PE Header.\r
+\r
+  @return TRUE if this PE/COFF loader can load the image\r
+\r
+**/\r
+BOOLEAN\r
+PeCoffLoaderImageFormatSupported (\r
+  IN  UINT16  Machine\r
+  );\r
+\r
+/**\r
+  Retrieves the magic value from the PE/COFF header.\r
+\r
+  @param  Hdr             The buffer in which to return the PE32, PE32+, or TE header.\r
+\r
+  @return EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC - Image is PE32\r
+  @return EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC - Image is PE32+\r
+\r
+**/\r
+UINT16\r
+PeCoffLoaderGetPeHeaderMagicValue (\r
+  IN  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr\r
+  );\r
+\r
+/**\r
+  Retrieves the PE or TE Header from a PE/COFF or TE image.\r
+\r
+  @param  ImageContext    The context of the image being loaded.\r
+  @param  Hdr             The buffer in which to return the PE32, PE32+, or TE header.\r
+\r
+  @retval RETURN_SUCCESS  The PE or TE Header is read.\r
+  @retval Other           The error status from reading the PE/COFF or TE image using the ImageRead function.\r
+\r
+**/\r
+RETURN_STATUS\r
+PeCoffLoaderGetPeHeader (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext,\r
+  OUT    EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr\r
+  );\r
+\r
+/**\r
+  Converts an image address to the loaded address.\r
+\r
+  @param  ImageContext  The context of the image being loaded.\r
+  @param  Address       The address to be converted to the loaded address.\r
+\r
+  @return The converted address or NULL if the address can not be converted.\r
+\r
+**/\r
+VOID *\r
+PeCoffLoaderImageAddress (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT          *ImageContext,\r
+  IN     UINTN                                 Address\r
+  );\r
+\r
+#endif\r