46 (*fmt) =
new ELF(image, size);
66 const Size maxSegments =
header->programHeaderEntryCount;
67 const Size maxRegions = *count;
68 Size numRegions = 0, numSegments = 0;
72 header->programHeaderEntryCount < 16))
78 for (;numRegions < maxRegions && numSegments < maxSegments; numSegments++)
86 regions[numRegions].dataOffset = segments[numSegments].
offset;
93 (*count) = numRegions;
101 const Size maxSegments =
header->programHeaderEntryCount;
102 const Size maxRegions = *count;
103 Size numRegions = 0, numSegments = 0;
107 header->programHeaderEntryCount < 16))
113 for (;numRegions < maxRegions && numSegments < maxSegments; numSegments++)
121 regions[numRegions].dataOffset = segments[numSegments].
offset;
128 (*count) = numRegions;
SystemDescriptorHeader header
Executable and Linkable Format (ELF).
virtual Result entry(Address *entry) const
Lookup the program entry point.
virtual Result regions(Region *regions, Size *count) const
Reads out segments from the ELF program table.
virtual Result regions64(Region *regions, Size *count) const
static Result detect(const u8 *image, const Size size, ExecutableFormat **fmt)
Read ELF header from memory.
virtual ~ELF()
Class destructor.
ELF(const u8 *image, const Size size)
Class constructor.
virtual Result regions32(Region *regions, Size *count) const
#define ELF_MAGIC0
Magic number byte 0.
#define ELF_MAGIC2
Magic number byte 2.
#define ELF_CLASS_64
64-bit objects.
#define ELF_MAGIC3
Magic number byte 3.
#define ELF_SEGMENT_LOAD
Loadable segment.
#define ELF_INDEX_MAGIC2
Magic number byte 2 index.
#define ELF_INDEX_CLASS
File class index.
#define ELF_CLASS_32
32-bit objects.
#define ELF_INDEX_MAGIC1
Magic number byte 1 index.
#define ELF_MAGIC1
Magic number byte 1.
#define ELF_VERSION_CURRENT
Current version.
#define ELF_INDEX_MAGIC0
Magic number byte 0 index.
#define ELF_INDEX_MAGIC3
Magic number byte 3 index.
#define ELF_TYPE_EXEC
Executable file.
unsigned long Address
A memory address.
unsigned int Size
Any sane size indicator cannot go negative.
unsigned char u8
Unsigned 8-bit number.
u64 memorySize
Segment memory image size.
u64 offset
Offset in the file of this segment.
u64 fileSize
Segment file image size.
u64 virtualAddress
Virtual address start.
ELF program segment in the executable file.
u32 memorySize
Segment memory image size.
u32 fileSize
Segment file image size.
u32 virtualAddress
Virtual address start.
u32 offset
Offset in the file of this segment.