Expand description
ELF Loading Module
This module provides functionality for loading ELF (Executable and Linkable Format) executables into a task’s memory space. It supports 64-bit ELF files and handles the parsing of ELF headers and program headers, as well as the mapping of loadable segments into memory.
§Components
ElfHeader
: Represents the ELF file header which contains metadata about the fileProgramHeader
: Represents a program header which describes a segment in the ELF fileLoadedSegment
: Represents a segment after it has been loaded into memory- Error types for handling various failure scenarios during ELF parsing and loading
§Main Functions
load_elf_into_task
: Loads an ELF file from a file handle into a task’s memory spacemap_elf_segment
: Maps an ELF segment into a task’s virtual memory
§Constants
The module defines various constants for ELF parsing, including:
- Magic numbers for identifying ELF files
- ELF class identifiers (64-bit)
- Data encoding formats (little/big endian)
- Program header types and segment flags (Read/Write/Execute)
§Endian Support
The module provides endian-aware data reading functions to correctly parse ELF files regardless of the endianness used in the file.
Structs§
Enums§
Constants§
- EI_
CLASS 🔒 - EI_DATA 🔒
- EI_MAG0 🔒
- EI_MAG1 🔒
- EI_MAG2 🔒
- EI_MAG3 🔒
- ELFCLAS
S64 🔒 - ELFDAT
A2LSB 🔒 - ELFMAG 🔒
- PF_R
- PF_W
- PF_X
- PT_LOAD 🔒
Functions§
- load_
elf_ into_ task - Load an ELF file into a task’s memory space
- map_
elf_ 🔒segment - read_
u16 🔒 - read_
u32 🔒 - read_
u64 🔒