diff options
author | norly <ny-git@enpas.org> | 2013-02-10 00:36:16 +0000 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2013-02-11 01:24:36 +0000 |
commit | feb8656ebe8c24137b179e1fc347c4fd3bf4bcd4 (patch) | |
tree | c64080870ae87ce1c42a7c52878f7278173ade80 /include/libelfu | |
parent | d9eb4398773cbda1dc185f4cf7b1b0e4cb9fb135 (diff) |
First memory model of an ELF file
Diffstat (limited to 'include/libelfu')
-rw-r--r-- | include/libelfu/libelfu.h | 1 | ||||
-rw-r--r-- | include/libelfu/model.h | 50 |
2 files changed, 51 insertions, 0 deletions
diff --git a/include/libelfu/libelfu.h b/include/libelfu/libelfu.h index 1c40541..28a1e9a 100644 --- a/include/libelfu/libelfu.h +++ b/include/libelfu/libelfu.h @@ -6,6 +6,7 @@ #include <libelfu/analysis.h> #include <libelfu/lookup.h> +#include <libelfu/model.h> #endif diff --git a/include/libelfu/model.h b/include/libelfu/model.h new file mode 100644 index 0000000..05f31ca --- /dev/null +++ b/include/libelfu/model.h @@ -0,0 +1,50 @@ +#ifndef __LIBELFU_MODEL_H__ +#define __LIBELFU_MODEL_H__ + +#include <sys/queue.h> + +#include <elf.h> +#include <gelf.h> + + +typedef struct ElfuData { + Elf_Data data; + + CIRCLEQ_ENTRY(ElfuData) elem; +} ElfuData; + + +typedef struct ElfuScn { + GElf_Shdr shdr; + + CIRCLEQ_HEAD(DataList, ElfuData) dataList; + + CIRCLEQ_ENTRY(ElfuScn) elem; +} ElfuScn; + + +typedef struct ElfuPhdr { + GElf_Phdr phdr; + + CIRCLEQ_ENTRY(ElfuPhdr) elem; +} ElfuPhdr; + + +typedef struct { + int elfclass; + GElf_Ehdr ehdr; + + CIRCLEQ_HEAD(ScnList, ElfuScn) scnList; + CIRCLEQ_HEAD(PhdrList, ElfuPhdr) phdrList; + + ElfuPhdr *entryBase; + GElf_Addr *entryOffs; +} ElfuElf; + + + +ElfuPhdr* elfu_modelFromPhdr(GElf_Phdr *phdr); +ElfuScn* elfu_modelFromSection(Elf_Scn *scn); +ElfuElf* elfu_modelFromElf(Elf *e); + +#endif |