MentOS
0.8.0
The Mentoring Operating System
|
Function for multiboot support. More...
Macros | |
#define | __DEBUG_HEADER__ "[ELF ]" |
Change header. | |
#define | __DEBUG_LEVEL__ LOGLEVEL_NOTICE |
Set log level. | |
Functions | |
static elf_section_header_t * | elf_get_section_header_table (elf_header_t *header) |
Returns the pointer to where the section headers reside. More... | |
static elf_program_header_t * | elf_get_program_header_table (elf_header_t *header) |
Returns the pointer to where the program headers reside. More... | |
static elf_section_header_t * | elf_get_section_header (elf_header_t *header, unsigned idx) |
Returns a pointer to the desired section header. More... | |
static elf_program_header_t * | elf_get_program_header (elf_header_t *header, unsigned idx) |
Returns a pointer to the desired program header. More... | |
static const char * | elf_get_section_header_string_table (elf_header_t *header) |
Returns a pointer to the section header string table. More... | |
static const char * | elf_get_symbol_string_table (elf_header_t *header, elf_section_header_t *section_header) |
Returns a pointer to the section header symbol table. More... | |
static const char * | elf_get_section_header_name (elf_header_t *header, elf_section_header_t *section_header) |
Returns the name of the given section header. More... | |
static const char * | elf_get_symbol_name (elf_header_t *header, elf_section_header_t *section_header, elf_symbol_t *symbol) |
Returns a pointer to the section header string table. More... | |
static elf_section_header_t * | elf_find_section_header (elf_header_t *header, const char *name) |
Finds the section header with the given name. More... | |
static elf_symbol_t * | elf_find_symbol (elf_header_t *header, const char *name) |
Finds the symbol with the given name. More... | |
static void | elf_dump_section_headers (elf_header_t *header) |
Dumps the information about the sections. More... | |
static void | elf_dump_symbol_table (elf_header_t *header) |
Dumps the information about the symbols. More... | |
static int | elf_load_exec (elf_header_t *header, task_struct *task) |
Loads an ELF executable. More... | |
int | elf_load_file (task_struct *task, vfs_file_t *file, uint32_t *entry) |
Loads an ELF file into the memory of task. More... | |
int | elf_check_file_type (vfs_file_t *file, Elf_Type type) |
Checks if the file is a valid ELF. More... | |
int | elf_check_file_header (elf_header_t *header) |
Checks the correctness of the ELF header. More... | |
int | elf_check_magic_number (elf_header_t *header) |
Checks the correctness of the ELF header magic number. More... | |
const char * | elf_type_to_string (int type) |
Transforms the passed ELF type to string. More... | |
const char * | elf_section_header_type_to_string (int type) |
Transforms the passed ELF section header type to string. More... | |
const char * | elf_symbol_type_to_string (int type) |
Transforms the passed ELF symbol type to string. More... | |
const char * | elf_symbol_bind_to_string (int bind) |
Transforms the passed ELF symbol bind to string. More... | |
Function for multiboot support.
int elf_check_file_header | ( | elf_header_t * | hdr | ) |
Checks the correctness of the ELF header.
hdr | The header to check. |
int elf_check_file_type | ( | vfs_file_t * | file, |
Elf_Type | type | ||
) |
Checks if the file is a valid ELF.
file | The file to check. |
type | The type of ELF file we expect. |
int elf_check_magic_number | ( | elf_header_t * | hdr | ) |
Checks the correctness of the ELF header magic number.
hdr | The header to check. |
|
inlinestatic |
Dumps the information about the sections.
header | a pointer to the ELF header. |
|
inlinestatic |
Dumps the information about the symbols.
header | a pointer to the ELF header. |
|
inlinestatic |
Finds the section header with the given name.
header | a pointer to the ELF header. |
name | the name of the section we are looking for. |
|
inlinestatic |
Finds the symbol with the given name.
header | a pointer to the ELF header. |
name | the name of the symbol we are looking for. |
|
inlinestatic |
Returns a pointer to the desired program header.
header | a pointer to the ELF header. |
idx | the index of the program header. |
|
inlinestatic |
Returns the pointer to where the program headers reside.
header | a pointer to the ELF header. |
|
inlinestatic |
Returns a pointer to the desired section header.
header | a pointer to the ELF header. |
idx | The index of the section header. |
|
inlinestatic |
Returns the name of the given section header.
header | a pointer to the ELF header. |
section_header | a pointer to the section header. |
|
inlinestatic |
Returns a pointer to the section header string table.
header | a pointer to the ELF header. |
|
inlinestatic |
Returns the pointer to where the section headers reside.
header | a pointer to the ELF header. |
|
inlinestatic |
Returns a pointer to the section header string table.
header | a pointer to the ELF header. |
section_header | a pointer to the section header. |
symbol | a pointer to the symbol we want to get the name for. |
|
inlinestatic |
Returns a pointer to the section header symbol table.
header | a pointer to the ELF header. |
section_header | a pointer to the ELF section header. |
|
inlinestatic |
Loads an ELF executable.
header | The header of the ELF file. |
task | The task for which we load the ELF. |
int elf_load_file | ( | task_struct * | task, |
vfs_file_t * | file, | ||
uint32_t * | entry | ||
) |
Loads an ELF file into the memory of task.
task | The task for which we load the ELF. |
file | The ELF file. |
entry | The ELF binary entry. |
const char* elf_section_header_type_to_string | ( | int | type | ) |
Transforms the passed ELF section header type to string.
type | The integer representing the ELF section header type. |
const char* elf_symbol_bind_to_string | ( | int | bind | ) |
Transforms the passed ELF symbol bind to string.
bind | The integer representing the ELF symbol bind. |
const char* elf_symbol_type_to_string | ( | int | type | ) |
Transforms the passed ELF symbol type to string.
type | The integer representing the ELF symbol type. |
const char* elf_type_to_string | ( | int | type | ) |
Transforms the passed ELF type to string.
type | The integer representing the ELF type. |