Home | History | Annotate | Download | only in ArmShellCmdRunAxf
      1 /** @file
      2 *
      3 *  Copyright (c) 2014, ARM Limited. All rights reserved.
      4 *
      5 *  This program and the accompanying materials
      6 *  are licensed and made available under the terms and conditions of the BSD License
      7 *  which accompanies this distribution.  The full text of the license may be found at
      8 *  http://opensource.org/licenses/bsd-license.php
      9 *
     10 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 *
     13 **/
     14 
     15 #ifndef ELF_LOADER_H
     16 #define ELF_LOADER_H
     17 
     18 /**
     19   Check that the ELF File Header is valid and Machine type supported.
     20 
     21   Not all information is checked in the ELF header, only the stuff that
     22   matters to us in our simplified ELF loader.
     23 
     24   @param[in] ElfImage  Address of the ELF file to check.
     25 
     26   @retval EFI_SUCCESS on success.
     27   @retval EFI_INVALID_PARAMETER if the header is invalid.
     28   @retval EFI_UNSUPPORTED if the file type/platform is not supported.
     29 **/
     30 EFI_STATUS
     31 ElfCheckFile (
     32   IN  CONST VOID *ElfImage
     33   );
     34 
     35 
     36 /**
     37   Load a ELF file.
     38 
     39   @param[in]  ElfImage      Address of the ELF file in memory.
     40 
     41   @param[out] EntryPoint    Will be filled with the ELF entry point address.
     42 
     43   @param[out] ImageSize     Will be filled with the ELF size in memory. This will
     44                             effectively be equal to the sum of the segments sizes.
     45 
     46   This function assumes the header is valid and supported as checked with
     47   ElfCheckFile().
     48 
     49   NOTE:
     50    - We don't currently take the segment permissions into account (indicated by
     51      the program headers). It can be used to allocate pages with the right
     52      read/write/exec permissions.
     53 
     54   @retval EFI_SUCCESS on success.
     55   @retval EFI_INVALID_PARAMETER if the ELF file is invalid.
     56 **/
     57 EFI_STATUS
     58 ElfLoadFile (
     59   IN  CONST VOID   *ElfImage,
     60   OUT VOID        **EntryPoint,
     61   OUT LIST_ENTRY   *LoadList
     62   );
     63 
     64 #endif // ELF_LOADER_H
     65