]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.h
ArmPlatformPkg/ArmShellCmdRunAxf: Added 'runaxf' cmd to shell
[mirror_edk2.git] / ArmPlatformPkg / Library / ArmShellCmdRunAxf / ElfLoader.h
diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.h b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ElfLoader.h
new file mode 100644 (file)
index 0000000..7020a6c
--- /dev/null
@@ -0,0 +1,64 @@
+/** @file\r
+*\r
+*  Copyright (c) 2014, ARM Limited. All rights reserved.\r
+*\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
+**/\r
+\r
+#ifndef ELF_LOADER_H\r
+#define ELF_LOADER_H\r
+\r
+/**\r
+  Check that the ELF File Header is valid and Machine type supported.\r
+\r
+  Not all information is checked in the ELF header, only the stuff that\r
+  matters to us in our simplified ELF loader.\r
+\r
+  @param[in] ElfImage  Address of the ELF file to check.\r
+\r
+  @retval EFI_SUCCESS on success.\r
+  @retval EFI_INVALID_PARAMETER if the header is invalid.\r
+  @retval EFI_UNSUPPORTED if the file type/platform is not supported.\r
+**/\r
+EFI_STATUS\r
+ElfCheckFile (\r
+  IN  CONST VOID *ElfImage\r
+  );\r
+\r
+\r
+/**\r
+  Load a ELF file.\r
+\r
+  @param[in]  ElfImage      Address of the ELF file in memory.\r
+\r
+  @param[out] EntryPoint    Will be filled with the ELF entry point address.\r
+\r
+  @param[out] ImageSize     Will be filled with the ELF size in memory. This will\r
+                            effectively be equal to the sum of the segments sizes.\r
+\r
+  This function assumes the header is valid and supported as checked with\r
+  ElfCheckFile().\r
+\r
+  NOTE:\r
+   - We don't currently take the segment permissions into account (indicated by\r
+     the program headers). It can be used to allocate pages with the right\r
+     read/write/exec permissions.\r
+\r
+  @retval EFI_SUCCESS on success.\r
+  @retval EFI_INVALID_PARAMETER if the ELF file is invalid.\r
+**/\r
+EFI_STATUS\r
+ElfLoadFile (\r
+  IN  CONST VOID   *ElfImage,\r
+  OUT VOID        **EntryPoint,\r
+  OUT LIST_ENTRY   *LoadList\r
+  );\r
+\r
+#endif // ELF_LOADER_H\r