TianoCore EDK2 master
Loading...
Searching...
No Matches
ElfLibInternal.h File Reference
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include "ElfLib.h"
#include "ElfCommon.h"
#include "Elf32.h"
#include "Elf64.h"

Go to the source code of this file.

Macros

#define ELF_NEXT_ENTRY(EntryType, Current, EntrySize)    ((EntryType *) ((UINT8 *)Current + EntrySize))
 

Functions

Elf32_ShdrGetElf32SectionByIndex (IN UINT8 *ImageBase, IN UINT32 Index)
 
Elf64_ShdrGetElf64SectionByIndex (IN UINT8 *ImageBase, IN UINT32 Index)
 
Elf32_PhdrGetElf32SegmentByIndex (IN UINT8 *ImageBase, IN UINT32 Index)
 
Elf64_PhdrGetElf64SegmentByIndex (IN UINT8 *ImageBase, IN UINT32 Index)
 
EFI_STATUS LoadElf32Image (IN ELF_IMAGE_CONTEXT *ElfCt)
 
EFI_STATUS LoadElf64Image (IN ELF_IMAGE_CONTEXT *ElfCt)
 

Detailed Description

ELF library

Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ElfLibInternal.h.

Macro Definition Documentation

◆ ELF_NEXT_ENTRY

#define ELF_NEXT_ENTRY (   EntryType,
  Current,
  EntrySize 
)     ((EntryType *) ((UINT8 *)Current + EntrySize))

Definition at line 20 of file ElfLibInternal.h.

Function Documentation

◆ GetElf32SectionByIndex()

Elf32_Shdr * GetElf32SectionByIndex ( IN UINT8 *  ImageBase,
IN UINT32  Index 
)

Return the section header specified by Index.

Parameters
ImageBaseThe image base.
IndexThe section index.
Returns
Pointer to the section header.

Definition at line 20 of file Elf32Lib.c.

◆ GetElf32SegmentByIndex()

Elf32_Phdr * GetElf32SegmentByIndex ( IN UINT8 *  ImageBase,
IN UINT32  Index 
)

Return the segment header specified by Index.

Parameters
ImageBaseThe image base.
IndexThe segment index.
Returns
Pointer to the segment header.

Definition at line 44 of file Elf32Lib.c.

◆ GetElf64SectionByIndex()

Elf64_Shdr * GetElf64SectionByIndex ( IN UINT8 *  ImageBase,
IN UINT32  Index 
)

Return the section header specified by Index.

Parameters
ImageBaseThe image base.
IndexThe section index.
Returns
Pointer to the section header.

Definition at line 20 of file Elf64Lib.c.

◆ GetElf64SegmentByIndex()

Elf64_Phdr * GetElf64SegmentByIndex ( IN UINT8 *  ImageBase,
IN UINT32  Index 
)

Return the segment header specified by Index.

Parameters
ImageBaseThe image base.
IndexThe segment index.
Returns
Pointer to the segment header.

Definition at line 44 of file Elf64Lib.c.

◆ LoadElf32Image()

EFI_STATUS LoadElf32Image ( IN ELF_IMAGE_CONTEXT ElfCt)

Load ELF image which has 32-bit architecture

Parameters
[in]ElfCtELF image context pointer.
Return values
EFI_SUCCESSELF binary is loaded successfully.
OthersLoading ELF binary fails.

Load ELF image which has 32-bit architecture.

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.

Parameters
[in]ElfCtELF image context pointer.
Return values
EFI_SUCCESSELF binary is loaded successfully.
OthersLoading ELF binary fails.

Definition at line 430 of file Elf32Lib.c.

◆ LoadElf64Image()

EFI_STATUS LoadElf64Image ( IN ELF_IMAGE_CONTEXT ElfCt)

Load ELF image which has 64-bit architecture

Parameters
[in]ImageBaseMemory address of an image.
[out]EntryPointThe entry point of loaded ELF image.
Return values
EFI_SUCCESSELF binary is loaded successfully.
OthersLoading ELF binary fails.

Load ELF image which has 64-bit architecture.

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.

Parameters
[in]ElfCtELF image context pointer.
Return values
EFI_SUCCESSELF binary is loaded successfully.
OthersLoading ELF binary fails.

Definition at line 439 of file Elf64Lib.c.