MOS Source Code
Loading...
Searching...
No Matches
elf.hpp File Reference
#include "mos/tasks/process.hpp"
#include "mos/tasks/task_types.hpp"
#include <elf.h>
#include <mos/types.hpp>
#include <mos/vector.hpp>
Include dependency graph for elf.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  elf_identity_t
struct  elf_header_t
struct  elf_program_hdr_t
struct  elf_startup_info_t

Macros

#define ELF_ENDIANNESS_MOS_DEFAULT   ELF_ENDIANNESS_MSB

Enumerations

enum  elf_endianness { ELF_ENDIANNESS_INVALID = 0 , ELF_ENDIANNESS_LSB = 1 , ELF_ENDIANNESS_MSB = 2 }
enum  elf_program_header_type {
  ELF_PT_NULL = 0 , ELF_PT_LOAD = 1 , ELF_PT_DYNAMIC = 2 , ELF_PT_INTERP = 3 ,
  ELF_PT_NOTE = 4 , ELF_PT_SHLIB = 5 , ELF_PT_PHDR = 6 , ELF_PT_TLS = 7 ,
  _ELF_PT_COUNT , ELF_PT_OS_LOW = 0x60000000 , ELF_PT_OS_HIGH = 0x6fffffff , ELF_PT_PROCESSOR_LO = 0x70000000 ,
  ELF_PT_PROCESSOR_HI = 0x7fffffff
}
enum  elf_ph_flags { ELF_PF_X = 1 << 0 , ELF_PF_W = 1 << 1 , ELF_PF_R = 1 << 2 }

Functions

 MOS_STATIC_ASSERT (sizeof(elf_identity_t)==16, "elf_identity_t has wrong size")
bool elf_read_and_verify_executable (FsBaseFile *file, elf_header_t *header)
bool elf_do_fill_process (Process *proc, FsBaseFile *file, elf_header_t elf, elf_startup_info_t *info)
Procesself_create_process (mos::string_view path, Process *parent, const mos::vector< mos::string > &argv, const mos::vector< mos::string > &envp, const stdio_t *ios)

Macro Definition Documentation

◆ ELF_ENDIANNESS_MOS_DEFAULT

#define ELF_ENDIANNESS_MOS_DEFAULT   ELF_ENDIANNESS_MSB

Definition at line 22 of file elf.hpp.

Referenced by elf_verify_header().

Enumeration Type Documentation

◆ elf_endianness

Enumerator
ELF_ENDIANNESS_INVALID 
ELF_ENDIANNESS_LSB 
ELF_ENDIANNESS_MSB 

Definition at line 12 of file elf.hpp.

◆ elf_program_header_type

Enumerator
ELF_PT_NULL 
ELF_PT_LOAD 
ELF_PT_DYNAMIC 
ELF_PT_INTERP 
ELF_PT_NOTE 
ELF_PT_SHLIB 
ELF_PT_PHDR 
ELF_PT_TLS 
_ELF_PT_COUNT 
ELF_PT_OS_LOW 
ELF_PT_OS_HIGH 
ELF_PT_PROCESSOR_LO 
ELF_PT_PROCESSOR_HI 

Definition at line 61 of file elf.hpp.

◆ elf_ph_flags

Enumerator
ELF_PF_X 
ELF_PF_W 
ELF_PF_R 

Definition at line 80 of file elf.hpp.

Function Documentation

◆ MOS_STATIC_ASSERT()

MOS_STATIC_ASSERT ( sizeof(elf_identity_t) = =16,
"elf_identity_t has wrong size"  )

◆ elf_read_and_verify_executable()

bool elf_read_and_verify_executable ( FsBaseFile * file,
elf_header_t * header )
nodiscard

Definition at line 347 of file elf.cpp.

Referenced by elf_fill_process(), elf_map_interpreter(), and process_do_execveat().

Here is the call graph for this function:

◆ elf_do_fill_process()

bool elf_do_fill_process ( Process * proc,
FsBaseFile * file,
elf_header_t elf,
elf_startup_info_t * info )
nodiscard

Definition at line 232 of file elf.cpp.

Referenced by elf_fill_process(), and process_do_execveat().

Here is the call graph for this function:

◆ elf_create_process()

Process * elf_create_process ( mos::string_view path,
Process * parent,
const mos::vector< mos::string > & argv,
const mos::vector< mos::string > & envp,
const stdio_t * ios )

Definition at line 384 of file elf.cpp.

Referenced by mos_start_kernel(), and MOS_STATIC_ASSERT().

Here is the call graph for this function: