Abstract base class for Linux-specific executable loading and setup routines.
More...
#include <lnx_loader.hpp>
|
| 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.
|
| |
Abstract base class for Linux-specific executable loading and setup routines.
◆ LinuxLoader()
| arion::LinuxLoader::LinuxLoader |
( |
std::weak_ptr< Arion > |
arion, |
|
|
const std::vector< std::string > |
program_args, |
|
|
const std::vector< std::string > |
program_env |
|
) |
| |
|
inlineprotected |
Builder for LinuxLoader instances.
- Parameters
-
| [in] | arion | Weak pointer to the Arion emulator instance. |
| [in] | program_args | Vector of command-line arguments. |
| [in] | program_env | Vector of environment variables. |
◆ init_main_thread()
| void arion::LinuxLoader::init_main_thread |
( |
std::shared_ptr< LNX_LOADER_PARAMS > |
params, |
|
|
ADDR |
entry_addr |
|
) |
| |
|
protected |
Initializes the main thread's registers (e.g., PC, stack pointer) for execution to begin.
- Parameters
-
| [in] | params | Shared pointer to the loader parameters structure. |
| [in] | entry_addr | The initial entry point address (usually the program or interpreter entry point). |
◆ map_stack()
Maps the initial process stack into memory and writes the argument/environment strings onto it.
- Parameters
-
| [in] | params | Shared pointer to the loader parameters structure. |
| [in] | path | The path to the executable file. |
- Returns
- The base address of the mapped stack.
◆ process()
◆ setup_argv()
| void arion::LinuxLoader::setup_argv |
( |
std::vector< ADDR > |
argv_ptrs | ) |
|
|
private |
Writes the argument pointers (argv) to the stack.
- Parameters
-
| [in] | argv_ptrs | Vector of memory addresses pointing to the argument strings. |
◆ setup_auxv()
Completes the setup of the Auxiliary Vector, writing key addresses and values to the stack.
- Parameters
-
| [in] | auxv_ptrs | Unique pointer to the structure holding temporary addresses for string placement. |
| [in] | params | Shared pointer to the structure holding loaded addresses. |
◆ setup_envp()
| void arion::LinuxLoader::setup_envp |
( |
std::vector< ADDR > |
envp_ptrs | ) |
|
|
private |
Writes the environment variable pointers to the stack.
- Parameters
-
| [in] | envp_ptrs | Vector of memory addresses pointing to the environment strings. |
◆ setup_specific_auxv()
| virtual void arion::LinuxLoader::setup_specific_auxv |
( |
std::shared_ptr< LNX_LOADER_PARAMS > |
params, |
|
|
uint16_t |
arch_sz |
|
) |
| |
|
protectedpure virtual |
**(Pure Virtual)** Sets up architecture-specific AUXV entries (to be implemented by derived classes).
- Parameters
-
| [in] | params | Shared pointer to the loader parameters structure. |
| [in] | arch_sz | The size of the architecture (32 or 64 bit). |
Implemented in arion::ElfLoader, and arion::LinuxBaremetalLoader.
◆ write_auxv_entry()
| void arion::LinuxLoader::write_auxv_entry |
( |
AUXV |
auxv, |
|
|
uint64_t |
val |
|
) |
| |
|
protected |
Writes a single entry (key-value pair) to the Auxiliary Vector on the stack.
- Parameters
-
| [in] | auxv | The AUXV key. |
| [in] | val | The corresponding value to store. |
◆ arion
| std::weak_ptr<Arion> arion::LinuxLoader::arion |
|
protected |
Weak pointer back to the main Arion instance.
◆ program_args
| const std::vector<std::string> arion::LinuxLoader::program_args |
|
protected |
Vector of command-line arguments.
◆ program_env
| const std::vector<std::string> arion::LinuxLoader::program_env |
|
protected |
Vector of environment variables.
The documentation for this class was generated from the following file:
- /home/runner/work/Arion/Arion/include/arion/platforms/linux/lnx_loader.hpp