![]() |
MOS Source Code
|
#include "mos/tasks/elf.hpp"
#include "mos/filesystem/vfs.hpp"
#include "mos/io/io.hpp"
#include "mos/mm/mm.hpp"
#include "mos/mm/mmap.hpp"
#include "mos/platform/platform.hpp"
#include "mos/syslog/printk.hpp"
#include "mos/tasks/process.hpp"
#include "mos/tasks/schedule.hpp"
#include "mos/tasks/task_types.hpp"
#include "mos/tasks/thread.hpp"
#include <mos/types.hpp>
#include <mos_stdlib.hpp>
#include <mos_string.hpp>
Go to the source code of this file.
Functions | |
MOS_STATIC_ASSERT (sizeof(elf_header_t)==0x40, "elf_header has wrong size") | |
MOS_STATIC_ASSERT (sizeof(elf_program_hdr_t)==0x38, "elf_program_header has wrong size") | |
static void | add_auxv_entry (auxv_vec_t *var, unsigned long type, unsigned long val) |
static bool | elf_verify_header (const elf_header_t *header) |
static bool | elf_read_file (file_t *file, void *buf, off_t offset, size_t size) |
static ptr_t | elf_determine_loadbias (elf_header_t *elf) |
static void | elf_setup_main_thread (Thread *thread, elf_startup_info_t *const info, ptr_t *const out_pargv, ptr_t *const out_penvp) |
static void | elf_map_segment (const elf_program_hdr_t *const ph, ptr_t map_bias, MMContext *mm, file_t *file) |
static ptr_t | elf_map_interpreter (const char *path, MMContext *mm) |
__nodiscard bool | elf_do_fill_process (Process *proc, file_t *file, elf_header_t elf, elf_startup_info_t *info) |
bool | elf_read_and_verify_executable (file_t *file, elf_header_t *header) |
bool | elf_fill_process (Process *proc, file_t *file, const char *path, const char *const argv[], const char *const envp[]) |
Process * | elf_create_process (const char *path, Process *parent, const char *const argv[], const char *const envp[], const stdio_t *ios) |
MOS_STATIC_ASSERT | ( | sizeof(elf_header_t) | = =0x40, |
"elf_header has wrong size" | ) |
MOS_STATIC_ASSERT | ( | sizeof(elf_program_hdr_t) | = =0x38, |
"elf_program_header has wrong size" | ) |
|
static |
Definition at line 23 of file elf.cpp.
Referenced by elf_do_fill_process(), and elf_setup_main_thread().
|
static |
Definition at line 32 of file elf.cpp.
Referenced by elf_read_and_verify_executable().
Definition at line 58 of file elf.cpp.
Referenced by elf_do_fill_process(), elf_map_interpreter(), and elf_read_and_verify_executable().
|
static |
Definition at line 64 of file elf.cpp.
Referenced by elf_do_fill_process().
|
static |
Typical Stack Layout:
(low address) |-> u32 argc |-> ptr_t argv[] | |-> NULL |-> ptr_t envp[] | |-> NULL |-> AuxV | |-> AT_... | |-> AT_NULL |-> argv strings, NULL-terminated |-> environment strings, NULL-terminated |-> u32 zero (high address, end of stack)
Definition at line 88 of file elf.cpp.
Referenced by elf_do_fill_process().
|
static |
Definition at line 158 of file elf.cpp.
Referenced by elf_do_fill_process(), and elf_map_interpreter().
Definition at line 203 of file elf.cpp.
Referenced by elf_do_fill_process().
__nodiscard bool elf_do_fill_process | ( | Process * | proc, |
file_t * | file, | ||
elf_header_t | elf, | ||
elf_startup_info_t * | info ) |
Definition at line 243 of file elf.cpp.
Referenced by elf_fill_process(), and process_do_execveat().
bool elf_read_and_verify_executable | ( | file_t * | file, |
elf_header_t * | header ) |
Definition at line 351 of file elf.cpp.
Referenced by elf_fill_process(), elf_map_interpreter(), and process_do_execveat().
bool elf_fill_process | ( | Process * | proc, |
file_t * | file, | ||
const char * | path, | ||
const char *const | argv[], | ||
const char *const | envp[] ) |
Definition at line 366 of file elf.cpp.
Referenced by elf_create_process().
Process * elf_create_process | ( | const char * | path, |
Process * | parent, | ||
const char *const | argv[], | ||
const char *const | envp[], | ||
const stdio_t * | ios ) |
Definition at line 420 of file elf.cpp.
Referenced by mos_start_kernel(), and MOS_STATIC_ASSERT().