TianoCore EDK2 master
|
#include "ElfLibInternal.h"
Go to the source code of this file.
Functions | |
BOOLEAN | IsElfFormat (IN CONST UINT8 *ImageBase) |
EFI_STATUS | CalculateElfFileSize (IN ELF_IMAGE_CONTEXT *ElfCt, OUT UINTN *FileSize) |
EFI_STATUS | GetElfSegmentInfo (IN UINT8 *ImageBase, IN UINT32 EiClass, IN UINT32 Index, OUT SEGMENT_INFO *SegInfo) |
EFI_STATUS EFIAPI | ParseElfImage (IN VOID *ImageBase, OUT ELF_IMAGE_CONTEXT *ElfCt) |
EFI_STATUS EFIAPI | LoadElfImage (IN ELF_IMAGE_CONTEXT *ElfCt) |
EFI_STATUS EFIAPI | GetElfSectionName (IN ELF_IMAGE_CONTEXT *ElfCt, IN UINT32 SectionIndex, OUT CHAR8 **SectionName) |
EFI_STATUS EFIAPI | GetElfSectionPos (IN ELF_IMAGE_CONTEXT *ElfCt, IN UINT32 Index, OUT UINTN *Offset, OUT UINTN *Size) |
ELF library
Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ElfLib.c.
EFI_STATUS CalculateElfFileSize | ( | IN ELF_IMAGE_CONTEXT * | ElfCt, |
OUT UINTN * | FileSize | ||
) |
Calculate a ELF file size.
[in] | ElfCt | ELF image context pointer. |
[out] | FileSize | Return the file size. |
EFI_INVALID_PARAMETER | ElfCt or SecPos is NULL. |
EFI_NOT_FOUND | Could not find the section. |
EFI_SUCCESS | Section posistion was filled successfully. |
EFI_STATUS EFIAPI GetElfSectionName | ( | IN ELF_IMAGE_CONTEXT * | ElfCt, |
IN UINT32 | SectionIndex, | ||
OUT CHAR8 ** | SectionName | ||
) |
Get a ELF section name from its index.
[in] | ElfCt | ELF image context pointer. |
[in] | SectionIndex | ELF section index. |
[out] | SectionName | The pointer to the section name. |
EFI_INVALID_PARAMETER | ElfCt or SecName is NULL. |
EFI_NOT_FOUND | Could not find the section. |
EFI_SUCCESS | Section name was filled successfully. |
EFI_STATUS EFIAPI GetElfSectionPos | ( | IN ELF_IMAGE_CONTEXT * | ElfCt, |
IN UINT32 | Index, | ||
OUT UINTN * | Offset, | ||
OUT UINTN * | Size | ||
) |
Get the offset and size of x-th ELF section.
[in] | ElfCt | ELF image context pointer. |
[in] | Index | ELF section index. |
[out] | Offset | Return the offset of the specific section. |
[out] | Size | Return the size of the specific section. |
EFI_INVALID_PARAMETER | ImageBase, Offset or Size is NULL. |
EFI_INVALID_PARAMETER | EiClass doesn't equal to ELFCLASS32 or ELFCLASS64. |
EFI_NOT_FOUND | Could not find the section. |
EFI_SUCCESS | Offset and Size are returned. |
EFI_STATUS GetElfSegmentInfo | ( | IN UINT8 * | ImageBase, |
IN UINT32 | EiClass, | ||
IN UINT32 | Index, | ||
OUT SEGMENT_INFO * | SegInfo | ||
) |
Get a ELF program segment loading info.
[in] | ImageBase | Image base. |
[in] | EiClass | ELF class. |
[in] | Index | ELF segment index. |
[out] | SegInfo | The pointer to the segment info. |
EFI_INVALID_PARAMETER | ElfCt or SecPos is NULL. |
EFI_NOT_FOUND | Could not find the section. |
EFI_SUCCESS | Section posistion was filled successfully. |
EFI_STATUS EFIAPI LoadElfImage | ( | IN ELF_IMAGE_CONTEXT * | ElfCt | ) |
Load the ELF image to Context.ImageAddress.
Context should be initialized by ParseElfImage(). Caller should set Context.ImageAddress to a proper value, either pointing to a new allocated memory whose size equal to Context.ImageSize, or pointing to Context.PreferredImageAddress.
[in] | ElfCt | ELF image context pointer. |
EFI_INVALID_PARAMETER | Input parameters are not valid. |
EFI_UNSUPPORTED | Unsupported binary type. |
EFI_LOAD_ERROR | ELF binary loading error. |
EFI_SUCCESS | ELF binary is loaded successfully. |
EFI_STATUS EFIAPI ParseElfImage | ( | IN VOID * | ImageBase, |
OUT ELF_IMAGE_CONTEXT * | ElfCt | ||
) |
Parse the ELF image info.
On return, all fields in ElfCt are updated except ImageAddress.
[in] | ImageBase | Memory address of an image. |
[out] | ElfCt | The EFL image context pointer. |
EFI_INVALID_PARAMETER | Input parameters are not valid. |
EFI_UNSUPPORTED | Unsupported binary type. |
EFI_LOAD_ERROR | ELF binary loading error. |
EFI_SUCCESS | ELF binary is loaded successfully. |