TianoCore EDK2 master
|
#include <PiPei.h>
Go to the source code of this file.
Data Structures | |
struct | ELF_IMAGE_CONTEXT |
struct | SEGMENT_INFO |
Macros | |
#define | ELF_CLASS32 1 |
#define | ELF_CLASS64 2 |
#define | ELF_PT_LOAD 1 |
Functions | |
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) 2018 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file ElfLib.h.
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 EFIAPI LoadElfImage | ( | IN ELF_IMAGE_CONTEXT * | ElfCt | ) |
Load the ELF segments to specified address in ELF header.
This function loads ELF image segments into memory address specified in ELF program header.
[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. |
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.
[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. |
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. |