docs: documented ELF loading / segment mapping
This commit is contained in:
parent
6d41f659d3
commit
942fc31c4f
|
@ -300,10 +300,12 @@ More information can be found on the limine project's [GitHub](https://github.co
|
||||||
This struct holds the parsed data of an ELF executable.
|
This struct holds the parsed data of an ELF executable.
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|--------------|--------------|----------------------------------------------------------------------------------------------------------------------------------|
|
|--------------|----------------|----------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| header | elf_header_T | The header of the elf file |
|
| header | elf_header_T | The header of the elf file |
|
||||||
| num_symbols | uint64_t | The size of _symbols_ |
|
| num_symbols | uint64_t | The size of _symbols_ |
|
||||||
| symbols | symbol_T* | An array containing all symbols of the elf file |
|
| symbols | symbol_T* | An array containing all symbols of the elf file |
|
||||||
|
| num_mappings | uint64_t | The size of _mappings_ |
|
||||||
|
| mappings | elf_mapping_T* | An array containing the mappings needed to load the elf file |
|
||||||
| string_table | void* | A copy of the elf files `.strtab` section, all strings are referenced here to have them available even if the elf file is closed |
|
| string_table | void* | A copy of the elf files `.strtab` section, all strings are referenced here to have them available even if the elf file is closed |
|
||||||
|
|
||||||
#### `elf_executable_temp_T` - struct
|
#### `elf_executable_temp_T` - struct
|
||||||
|
@ -384,6 +386,22 @@ Holds the parsed kernel executable.
|
||||||
|
|
||||||
This will be removed, when processes are implemented, because then this can be accessed via the kernel process control struct.
|
This will be removed, when processes are implemented, because then this can be accessed via the kernel process control struct.
|
||||||
|
|
||||||
|
### elf/mapping.h
|
||||||
|
#### `elf_mapping_T` - struct
|
||||||
|
A mapping describes an area of memory,
|
||||||
|
that should be copied from the elf file into the RAM and how/where it should be mapped.
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|----------------|----------|------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| offset_file | uint64_t | The mappings' start in the elf file |
|
||||||
|
| offset_virtual | uint64_t | The mappings' start in memory |
|
||||||
|
| length_file | uint64_t | The mappings' size in the elf file |
|
||||||
|
| length_virtual | uint64_t | The mappings' size in memory, if this is bigger than _length_file_ the remaining space will be filled with zeros |
|
||||||
|
|
||||||
|
#### `elf_mappings_apply(mappings, num_mappings, buffer, base, page_map)` - function (void)
|
||||||
|
Maps all **_mappings_** into **_page_map_** and copies the related data from **_buffer_** (elf file) to the mapped memory.
|
||||||
|
**_base_** specifies where the mappings should start in the virtual address space.
|
||||||
|
|
||||||
### elf/section.h
|
### elf/section.h
|
||||||
#### `elf_section_type_E` - enum
|
#### `elf_section_type_E` - enum
|
||||||
- **Null** - These sections can be ignored
|
- **Null** - These sections can be ignored
|
||||||
|
@ -415,6 +433,32 @@ This will be removed, when processes are implemented, because then this can be a
|
||||||
#### `g_elf_section_type_strings` - global variable
|
#### `g_elf_section_type_strings` - global variable
|
||||||
An array of strings matching `elf_section_type_E`.
|
An array of strings matching `elf_section_type_E`.
|
||||||
|
|
||||||
|
### elf/segment.h
|
||||||
|
#### `elf_segment_type_E` - enum
|
||||||
|
- **Null** - Unused segment
|
||||||
|
- **Load** - Segment that should be included into mappings
|
||||||
|
- **Dynamic** - Segments of this type contain dynamic linking information
|
||||||
|
- **Interpreter** - This holds a path to an interpreter
|
||||||
|
- **Note** - These segments hold notes by the compiler / toolchain
|
||||||
|
- **Program Header Table** - This points to the table that is holding the segment headers
|
||||||
|
- **TLS** - This holds a Thread Local Storage template
|
||||||
|
|
||||||
|
#### `elf_segment_T` - struct
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|------------------|----------|-----------------------------------------------------------------|
|
||||||
|
| type | uint32_t | The segments type -> `elf_segment_type_E` |
|
||||||
|
| flags | uint32_t | The segments flags (Read / Write / Execute) |
|
||||||
|
| offset | uint64_t | The segments position in the elf file |
|
||||||
|
| address_virtual | uint64_t | Where the segment should be mapped in the virtual address space |
|
||||||
|
| address_physical | uint64_t | Not used in the `System V` ABI |
|
||||||
|
| length_file | uint64_t | The segments size in the file |
|
||||||
|
| length_memory | uint64_t | The size of the area that should be mapped for the segment |
|
||||||
|
| align | uint64_t | The segments alignment (has to be a power of 2) |
|
||||||
|
|
||||||
|
#### `g_elf_segment_type_strings` - global variable
|
||||||
|
An array of strings matching `elf_segment_type_E`.
|
||||||
|
|
||||||
### elf/symbol.h
|
### elf/symbol.h
|
||||||
#### `ELF_SYMBOL_TYPE(info)` - macro
|
#### `ELF_SYMBOL_TYPE(info)` - macro
|
||||||
Extracts the `elf_symbol_type_E` from the symbols info value.
|
Extracts the `elf_symbol_type_E` from the symbols info value.
|
||||||
|
|
Loading…
Reference in New Issue