Executable and Linking Format.
More...
|
#define | MAGIC_0 0x7F |
| magic value expected at the beginning of an ELF file
|
|
#define | MAGIC_1 'E' |
| magic value expected at the beginning of an ELF file
|
|
#define | MAGIC_2 'L' |
| magic value expected at the beginning of an ELF file
|
|
#define | MAGIC_3 'F' |
| magic value expected at the beginning of an ELF file
|
|
#define | VERSION 1 |
| only ELF version 1 is supported (the current version)
|
|
|
enum | elf_class { CLASS_32_BIT = 1,
CLASS_64_BIT
} |
| 32 or 64 bit
|
|
enum | elf_data { DATA_LITTLE_ENDIAN = 1,
DATA_BIG_ENDIAN
} |
| little or big endian
|
|
enum | elf_type { TYPE_RELOCATABLE = 1,
TYPE_EXECUTABLE,
TYPE_SHARED,
TYPE_CORE
} |
| object type
|
|
enum | elf_machine { MACHINE_X86 = 3
} |
| targeted ISA, we are only interested in x86
|
|
Executable and Linking Format.
ELF files are used to execute external programs in user space.
- See also
- https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
-
http://wiki.osdev.org/ELF
-
http://lowlevel.eu/wiki/ELF
-
http://www.linux-kernel.de/appendix/ap05.pdf
static uint8_t elf_check |
( |
elf_t * |
elf | ) |
|
|
static |
Checks whether a pointer points to a valid ELF file for this OS.
- Parameters
-
elf | the start address of the ELF file in memory |
- Returns
- whether it is a valid ELF file
Definition at line 56 of file elf.c.
task_pid_t elf_create_task |
( |
elf_t * |
elf, |
|
|
size_t |
kernel_stack_len, |
|
|
size_t |
user_stack_len |
|
) |
| |
Creates a user task running the code of an ELF file.
- Parameters
-
elf | the start address of the ELF file in memory |
kernel_stack_len | number of bytes to allocate for the kernel stack |
user_stack_len | number of bytes to allocate for the user stack |
- Returns
- PID of the created ELF task
Definition at line 148 of file elf.c.
Destroys a user task running the code of an ELF file.
- Parameters
-
Definition at line 166 of file elf.c.
Loads the segments of an ELF file into memory.
- Parameters
-
elf | the start address of the ELF file in memory |
page_directory | a page directory to map the segments into |
- Returns
- the entry point as a virtual address
Definition at line 91 of file elf.c.
Frees the segments of an ELF file in memory.
- Parameters
-
elf | the start address of the ELF file in memory |
page_directory | a page directory to unmap the segments from |
Definition at line 127 of file elf.c.