A Linux loader implementation responsible for parsing and mapping ELF binaries (executables and dynamic loaders).
More...
#include <elf_loader.hpp>
|
| std::shared_ptr< ElfParser > | prog_parser |
| | ELF parser for the program interpreter (dynamic linker).
|
| |
| std::shared_ptr< ElfParser > | interp_parser |
| |
| bool | is_pie |
| | Flag indicating if the program is Position-Independent Executable (PIE).
|
| |
| bool | is_static |
| | Flag indicating if the program is statically linked.
|
| |
| std::weak_ptr< Arion > | arion |
| | Weak pointer back to the main Arion instance.
|
| |
| const std::vector< std::string > | program_args |
| | Vector of command-line arguments.
|
| |
| const std::vector< std::string > | program_env |
| | Vector of environment variables.
|
| |
A Linux loader implementation responsible for parsing and mapping ELF binaries (executables and dynamic loaders).
◆ ElfLoader() [1/2]
| arion::ElfLoader::ElfLoader |
( |
std::weak_ptr< Arion > |
arion, |
|
|
std::shared_ptr< ElfParser > |
interp_parser, |
|
|
std::shared_ptr< ElfParser > |
prog_parser, |
|
|
const std::vector< std::string > |
program_args, |
|
|
const std::vector< std::string > |
program_env |
|
) |
| |
|
inline |
Builder for a dynamically linked ElfLoader instance.
- Parameters
-
| [in] | arion | Weak pointer to the Arion emulator instance. |
| [in] | interp_parser | ELF parser for the dynamic linker. |
| [in] | prog_parser | ELF parser for the main program. |
| [in] | program_args | Vector of command-line arguments. |
| [in] | program_env | Vector of environment variables. |
◆ ElfLoader() [2/2]
| arion::ElfLoader::ElfLoader |
( |
std::weak_ptr< Arion > |
arion, |
|
|
std::shared_ptr< ElfParser > |
prog_parser, |
|
|
const std::vector< std::string > |
program_args, |
|
|
const std::vector< std::string > |
program_env |
|
) |
| |
|
inline |
Builder for a statically linked ElfLoader instance.
- Parameters
-
| [in] | arion | Weak pointer to the Arion emulator instance. |
| [in] | prog_parser | ELF parser for the main program. |
| [in] | program_args | Vector of command-line arguments. |
| [in] | program_env | Vector of environment variables. |
◆ init_coredump_threads()
| void arion::ElfLoader::init_coredump_threads |
( |
| ) |
|
|
private |
Initializes thread synchronization structures related to coredumps.
◆ map_arm_traps()
| ADDR arion::ElfLoader::map_arm_traps |
( |
| ) |
|
|
private |
Maps the 32-bit ARM kernel trap page into memory.
- Returns
- The base virtual address of the ARM traps page.
◆ map_elf_segments()
| ADDR arion::ElfLoader::map_elf_segments |
( |
const std::shared_ptr< ElfParser > |
parser, |
|
|
ADDR |
load_addr |
|
) |
| |
|
private |
Maps the loadable segments of an ELF binary into the emulator's memory space.
- Parameters
-
| [in] | parser | The ELF parser instance. |
| [in] | load_addr | The base virtual address to load the segments at. |
- Returns
- The actual base address where the ELF segments were loaded.
◆ map_vdso()
| ADDR arion::ElfLoader::map_vdso |
( |
| ) |
|
|
private |
Maps the kernel's Virtual Dynamic Shared Object (VDSO) page into memory.
- Returns
- The base virtual address of the VDSO page.
◆ map_vsyscall()
| ADDR arion::ElfLoader::map_vsyscall |
( |
| ) |
|
|
private |
Maps the kernel's Virtual Syscall (VSYSCALL) page into memory.
- Returns
- The base virtual address of the VSYSCALL page.
◆ map_vvar()
| ADDR arion::ElfLoader::map_vvar |
( |
| ) |
|
|
private |
Maps the kernel's Virtual Variable (VVAR) page into memory.
- Returns
- The base virtual address of the VVAR page.
◆ process()
Processes the ELF binary loading, mapping segments, setting up the stack, and finalizing the loader parameters.
- Returns
- A unique pointer to the finalized loader parameters (
LNX_LOADER_PARAMS).
Implements arion::LinuxLoader.
◆ setup_specific_auxv()
| void arion::ElfLoader::setup_specific_auxv |
( |
std::shared_ptr< LNX_LOADER_PARAMS > |
params, |
|
|
uint16_t |
arch_sz |
|
) |
| |
|
overrideprotectedvirtual |
Sets up architecture-specific Auxiliary Vector (AUXV) entries before execution starts.
- Parameters
-
| [in] | params | Shared pointer to the loader parameters structure. |
| [in] | arch_sz | The size of the architecture (32 or 64 bit). |
Implements arion::LinuxLoader.
◆ interp_parser
| std::shared_ptr<ElfParser> arion::ElfLoader::interp_parser |
|
private |
◆ is_pie
| bool arion::ElfLoader::is_pie |
|
private |
Flag indicating if the program is Position-Independent Executable (PIE).
◆ is_static
| bool arion::ElfLoader::is_static |
|
private |
Flag indicating if the program is statically linked.
◆ prog_parser
| std::shared_ptr<ElfParser> arion::ElfLoader::prog_parser |
|
private |
ELF parser for the program interpreter (dynamic linker).
The documentation for this class was generated from the following file:
- /home/runner/work/Arion/Arion/include/arion/platforms/linux/elf_loader.hpp