MOS Source Code
Loading...
Searching...
No Matches
elf.h File Reference
#include "mos/tasks/process.h"
#include "mos/tasks/task_types.h"
#include <elf.h>
#include <mos/types.h>
+ Include dependency graph for elf.h:
+ 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  auxv_vec_t
 
struct  elf_startup_info_t
 

Macros

#define ELF_ENDIANNESS_MOS_DEFAULT   ELF_ENDIANNESS_MSB
 
#define AUXV_VEC_SIZE   16
 

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")
 
__nodiscard bool elf_read_and_verify_executable (file_t *file, elf_header_t *header)
 
__nodiscard bool elf_fill_process (process_t *proc, file_t *file, const char *path, const char *const argv[], const char *const envp[])
 
__nodiscard bool elf_do_fill_process (process_t *proc, file_t *file, elf_header_t elf, elf_startup_info_t *info)
 
process_telf_create_process (const char *path, process_t *parent, const char *const argv[], const char *const envp[], const stdio_t *ios)
 

Macro Definition Documentation

◆ ELF_ENDIANNESS_MOS_DEFAULT

#define ELF_ENDIANNESS_MOS_DEFAULT   ELF_ENDIANNESS_MSB

Definition at line 21 of file elf.h.

Referenced by elf_verify_header().

◆ AUXV_VEC_SIZE

#define AUXV_VEC_SIZE   16

Definition at line 98 of file elf.h.

Referenced by add_auxv_entry().

Enumeration Type Documentation

◆ elf_endianness

Enumerator
ELF_ENDIANNESS_INVALID 
ELF_ENDIANNESS_LSB 
ELF_ENDIANNESS_MSB 

Definition at line 11 of file elf.h.

◆ 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 60 of file elf.h.

◆ elf_ph_flags

Enumerator
ELF_PF_X 
ELF_PF_W 
ELF_PF_R 

Definition at line 79 of file elf.h.

Function Documentation

◆ MOS_STATIC_ASSERT()

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

◆ elf_read_and_verify_executable()

__nodiscard bool elf_read_and_verify_executable ( file_t * file,
elf_header_t * header )

Definition at line 338 of file elf.c.

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

+ Here is the call graph for this function:

◆ elf_fill_process()

__nodiscard bool elf_fill_process ( process_t * proc,
file_t * file,
const char * path,
const char *const argv[],
const char *const envp[] )

Definition at line 353 of file elf.c.

Referenced by elf_create_process().

+ Here is the call graph for this function:

◆ elf_do_fill_process()

__nodiscard bool elf_do_fill_process ( process_t * proc,
file_t * file,
elf_header_t elf,
elf_startup_info_t * info )

Definition at line 230 of file elf.c.

Referenced by elf_fill_process(), and process_do_execveat().

+ Here is the call graph for this function:

◆ elf_create_process()

process_t * elf_create_process ( const char * path,
process_t * parent,
const char *const argv[],
const char *const envp[],
const stdio_t * ios )

Definition at line 408 of file elf.c.

Referenced by mos_start_kernel(), and MOS_STATIC_ASSERT().

+ Here is the call graph for this function: