|
FreeNOS
|
Executable and Linkable Format (ELF). More...
#include <ELF.h>
Public Member Functions | |
| ELF (const u8 *image, const Size size) | |
| Class constructor. More... | |
| virtual | ~ELF () |
| Class destructor. More... | |
| virtual Result | regions (Region *regions, Size *count) const |
| Reads out segments from the ELF program table. More... | |
| virtual Result | entry (Address *entry) const |
| Lookup the program entry point. More... | |
Public Member Functions inherited from ExecutableFormat | |
| ExecutableFormat (const u8 *image, const Size size) | |
| Class constructor. More... | |
| virtual | ~ExecutableFormat () |
| Class destructor. More... | |
Static Public Member Functions | |
| static Result | detect (const u8 *image, const Size size, ExecutableFormat **fmt) |
| Read ELF header from memory. More... | |
Static Public Member Functions inherited from ExecutableFormat | |
| static Result | find (const u8 *image, const Size size, ExecutableFormat **fmt) |
| Find a ExecutableFormat which can handle the given format. More... | |
Additional Inherited Members | |
Public Types inherited from ExecutableFormat | |
| enum | Result { Success, NotFound, InvalidFormat, OutOfMemory } |
| Result code. More... | |
| typedef struct ExecutableFormat::Region | Region |
| Memory region. More... | |
Protected Attributes inherited from ExecutableFormat | |
| const u8 * | m_image |
| Input image raw data. More... | |
| const Size | m_size |
| Input image size in bytes. More... | |
|
static |
Read ELF header from memory.
| image | Pointer to raw input image data |
| size | Number of bytes of input image data |
| fmt | Outputs a pointer to an ELF instance |
Definition at line 30 of file ELF.cpp.
References ELF(), ELF_CLASS_32, ELF_INDEX_CLASS, ELF_INDEX_MAGIC0, ELF_INDEX_MAGIC1, ELF_INDEX_MAGIC2, ELF_INDEX_MAGIC3, ELF_MAGIC0, ELF_MAGIC1, ELF_MAGIC2, ELF_MAGIC3, ELF_TYPE_EXEC, ELF_VERSION_CURRENT, header, ExecutableFormat::InvalidFormat, and ExecutableFormat::Success.
Referenced by ExecutableFormat::find().
|
virtual |
Lookup the program entry point.
| entry | Program entry point on output. |
Implements ExecutableFormat.
Definition at line 87 of file ELF.cpp.
References header, ExecutableFormat::m_image, and ExecutableFormat::Success.
|
virtual |
Reads out segments from the ELF program table.
| regions | Memory regions to fill. |
| count | Maximum number of memory regions on input. Actual number of memory regions on output. |
Implements ExecutableFormat.
Definition at line 52 of file ELF.cpp.
References ELF_SEGMENT_LOAD, Memory::Executable, ELFSegment::fileSize, header, ExecutableFormat::InvalidFormat, ExecutableFormat::m_image, ELFSegment::memorySize, ELFSegment::offset, Memory::Readable, ExecutableFormat::Success, type, Memory::User, ELFSegment::virtualAddress, and Memory::Writable.
1.8.17