|
The Pedigree Project 0.1
|
#include <ModuleImage.h>
Collaboration diagram for ModuleImage:Public Types | |
| enum class | Result { Valid , Malformed , Unsupported , TooLarge } |
| using | Header = Elf::ElfHeader_t |
| using | Segment = Elf::ElfProgramHeader_t |
| using | Section = Elf::ElfSectionHeader_t |
| using | Symbol = Elf::ElfSymbol_t |
| using | Relocation = Elf::ElfRela_t |
| using | Dynamic = Elf::ElfDyn_t |
Public Member Functions | |
| Result | preflight (const uint8_t *image, size_t length) |
| bool | symbol (size_t index, Symbol &result, bool dynamic=true) const |
| const char * | symbolName (const Symbol &value, bool dynamic=true) const |
| bool | findSymbol (const char *name, Symbol &result, bool dynamic=false) const |
| bool | relocation (size_t index, Relocation &result) const |
| bool | contains (uintptr_t address, size_t length, size_t flags=PF_R) const |
| bool | fileOffset (uintptr_t address, size_t length, size_t &offset) const |
| bool | localPointer (uintptr_t address, uintptr_t &target) const |
| bool | validateMaterialized (uintptr_t base) const |
| bool | exportedSymbol (size_t index, Symbol &result) const |
Public Attributes | |
| const uint8_t * | bytes |
| size_t | byteCount |
| Segment | segments [MaximumSegments] |
| size_t | segmentCount |
| size_t | mappedBytes |
| size_t | symbolCount |
| size_t | relocationCount |
| char | name [NameBytes] |
| char | dependencies [MaximumDependencies][NameBytes] |
| size_t | dependencyCount |
| char | optionalDependencies [MaximumDependencies][NameBytes] |
| size_t | optionalDependencyCount |
| uintptr_t | entry |
| uintptr_t | exit |
| uintptr_t | constructors [MaximumLifecycleFunctions] |
| size_t | constructorCount |
| uintptr_t | destructors [MaximumLifecycleFunctions] |
| size_t | destructorCount |
Static Public Attributes | |
| static constexpr size_t | MaximumImageBytes = 1024 * 1024 |
| static constexpr size_t | MaximumMappedBytes = 1024 * 1024 |
| static constexpr size_t | MaximumSegments = 16 |
| static constexpr size_t | MaximumSections = 256 |
| static constexpr size_t | MaximumSymbols = 4096 |
| static constexpr size_t | MaximumRelocations = 16384 |
| static constexpr size_t | MaximumDependencies = 16 |
| static constexpr size_t | MaximumLifecycleFunctions = 128 |
| static constexpr size_t | NameBytes = 56 |
| static constexpr size_t | SymbolNameBytes = 256 |
Private Member Functions | |
| bool | section (size_t index, Section &result) const |
| bool | string (size_t tableOffset, size_t tableBytes, size_t offset, const char *&result, size_t maximum) const |
| bool | mappedString (uintptr_t address, const char *&result, size_t maximum) const |
| bool | namedObject (const char *name, size_t size, Symbol &result) const |
| bool | dependenciesAt (const char *symbolName, char names[][NameBytes], size_t &count, bool optional) const |
| bool | lifecycle (const char *startName, const char *endName, uintptr_t *targets, size_t &count) const |
| Result | validateSections (const Header &header) |
| Result | validateDynamic () |
| Result | validateRelocations () |
| Result | validateMetadata () |
Private Attributes | |
| size_t | sectionOffset |
| size_t | sectionCount |
| size_t | sectionStrings |
| size_t | sectionStringBytes |
| size_t | dynamicOffset |
| size_t | dynamicBytes |
| size_t | symbols |
| size_t | symbolBytes |
| size_t | strings |
| size_t | stringBytes |
| size_t | fullSymbols |
| size_t | fullSymbolBytes |
| size_t | fullStrings |
| size_t | fullStringBytes |
| size_t | relocations |
| size_t | relocationBytes |
| uintptr_t | symbolAddress |
| uintptr_t | stringAddress |
| uintptr_t | relocationAddress |
| uintptr_t | constructorAddress |
| size_t | constructorBytes |
| uintptr_t | destructorAddress |
| size_t | destructorBytes |
Allocation-free plan over an immutable, kernel-owned native module image.
Definition at line 8 of file ModuleImage.h.
| using ModuleImage::Dynamic = Elf::ElfDyn_t |
Definition at line 27 of file ModuleImage.h.
| using ModuleImage::Header = Elf::ElfHeader_t |
Definition at line 22 of file ModuleImage.h.
Definition at line 26 of file ModuleImage.h.
Definition at line 24 of file ModuleImage.h.
Definition at line 23 of file ModuleImage.h.
| using ModuleImage::Symbol = Elf::ElfSymbol_t |
Definition at line 25 of file ModuleImage.h.
|
strong |
Definition at line 21 of file ModuleImage.h.
| ModuleImage::ModuleImage | ( | ) |
Definition at line 21 of file ModuleImage.cc.
| bool ModuleImage::contains | ( | uintptr_t | address, |
| size_t | length, | ||
| size_t | flags = PF_R |
||
| ) | const |
Definition at line 33 of file ModuleImage.cc.
|
private |
Definition at line 507 of file ModuleImage.cc.
| bool ModuleImage::exportedSymbol | ( | size_t | index, |
| Symbol & | result | ||
| ) | const |
Definition at line 619 of file ModuleImage.cc.
| bool ModuleImage::fileOffset | ( | uintptr_t | address, |
| size_t | length, | ||
| size_t & | offset | ||
| ) | const |
Definition at line 44 of file ModuleImage.cc.
| bool ModuleImage::findSymbol | ( | const char * | name, |
| Symbol & | result, | ||
| bool | dynamic = false |
||
| ) | const |
Definition at line 83 of file ModuleImage.cc.
|
private |
Definition at line 540 of file ModuleImage.cc.
| bool ModuleImage::localPointer | ( | uintptr_t | address, |
| uintptr_t & | target | ||
| ) | const |
Definition at line 111 of file ModuleImage.cc.
|
private |
Definition at line 609 of file ModuleImage.cc.
|
private |
Definition at line 494 of file ModuleImage.cc.
| ModuleImage::Result ModuleImage::preflight | ( | const uint8_t * | image, |
| size_t | length | ||
| ) |
Definition at line 139 of file ModuleImage.cc.
| bool ModuleImage::relocation | ( | size_t | index, |
| Relocation & | result | ||
| ) | const |
Definition at line 103 of file ModuleImage.cc.
|
private |
Definition at line 25 of file ModuleImage.cc.
|
private |
Definition at line 55 of file ModuleImage.cc.
| bool ModuleImage::symbol | ( | size_t | index, |
| Symbol & | result, | ||
| bool | dynamic = true |
||
| ) | const |
Definition at line 65 of file ModuleImage.cc.
| const char * ModuleImage::symbolName | ( | const Symbol & | value, |
| bool | dynamic = true |
||
| ) | const |
Definition at line 75 of file ModuleImage.cc.
|
private |
Definition at line 342 of file ModuleImage.cc.
| bool ModuleImage::validateMaterialized | ( | uintptr_t | base | ) | const |
Definition at line 628 of file ModuleImage.cc.
|
private |
Definition at line 569 of file ModuleImage.cc.
|
private |
Definition at line 455 of file ModuleImage.cc.
|
private |
Definition at line 215 of file ModuleImage.cc.
| size_t ModuleImage::byteCount |
Definition at line 43 of file ModuleImage.h.
| const uint8_t* ModuleImage::bytes |
Definition at line 42 of file ModuleImage.h.
|
private |
Definition at line 95 of file ModuleImage.h.
|
private |
Definition at line 96 of file ModuleImage.h.
| size_t ModuleImage::constructorCount |
Definition at line 57 of file ModuleImage.h.
| uintptr_t ModuleImage::constructors[MaximumLifecycleFunctions] |
Definition at line 56 of file ModuleImage.h.
| char ModuleImage::dependencies[MaximumDependencies][NameBytes] |
Definition at line 50 of file ModuleImage.h.
| size_t ModuleImage::dependencyCount |
Definition at line 51 of file ModuleImage.h.
|
private |
Definition at line 97 of file ModuleImage.h.
|
private |
Definition at line 98 of file ModuleImage.h.
| size_t ModuleImage::destructorCount |
Definition at line 59 of file ModuleImage.h.
| uintptr_t ModuleImage::destructors[MaximumLifecycleFunctions] |
Definition at line 58 of file ModuleImage.h.
|
private |
Definition at line 81 of file ModuleImage.h.
|
private |
Definition at line 80 of file ModuleImage.h.
| uintptr_t ModuleImage::entry |
Definition at line 54 of file ModuleImage.h.
| uintptr_t ModuleImage::exit |
Definition at line 55 of file ModuleImage.h.
|
private |
Definition at line 89 of file ModuleImage.h.
|
private |
Definition at line 88 of file ModuleImage.h.
|
private |
Definition at line 87 of file ModuleImage.h.
|
private |
Definition at line 86 of file ModuleImage.h.
| size_t ModuleImage::mappedBytes |
Definition at line 46 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 16 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 10 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 17 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 11 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 15 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 13 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 12 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 14 of file ModuleImage.h.
| char ModuleImage::name[NameBytes] |
Definition at line 49 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 18 of file ModuleImage.h.
| char ModuleImage::optionalDependencies[MaximumDependencies][NameBytes] |
Definition at line 52 of file ModuleImage.h.
| size_t ModuleImage::optionalDependencyCount |
Definition at line 53 of file ModuleImage.h.
|
private |
Definition at line 94 of file ModuleImage.h.
|
private |
Definition at line 91 of file ModuleImage.h.
| size_t ModuleImage::relocationCount |
Definition at line 48 of file ModuleImage.h.
|
private |
Definition at line 90 of file ModuleImage.h.
|
private |
Definition at line 77 of file ModuleImage.h.
|
private |
Definition at line 76 of file ModuleImage.h.
|
private |
Definition at line 79 of file ModuleImage.h.
|
private |
Definition at line 78 of file ModuleImage.h.
| size_t ModuleImage::segmentCount |
Definition at line 45 of file ModuleImage.h.
| Segment ModuleImage::segments[MaximumSegments] |
Definition at line 44 of file ModuleImage.h.
|
private |
Definition at line 93 of file ModuleImage.h.
|
private |
Definition at line 85 of file ModuleImage.h.
|
private |
Definition at line 84 of file ModuleImage.h.
|
private |
Definition at line 92 of file ModuleImage.h.
|
private |
Definition at line 83 of file ModuleImage.h.
| size_t ModuleImage::symbolCount |
Definition at line 47 of file ModuleImage.h.
|
staticconstexpr |
Definition at line 19 of file ModuleImage.h.
|
private |
Definition at line 82 of file ModuleImage.h.