Root/
| 1 | #ifndef __ELF__H__ |
| 2 | #define __ELF__H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | typedef uint16_t Elf32_Half; |
| 7 | typedef uint32_t Elf32_Word; |
| 8 | typedef uint32_t Elf32_Addr; |
| 9 | typedef uint32_t Elf32_Off; |
| 10 | typedef int32_t Elf32_Sword; |
| 11 | |
| 12 | #define EI_NIDENT 16 |
| 13 | #define EI_MAG0 0 |
| 14 | #define EI_MAG1 1 |
| 15 | #define EI_MAG2 2 |
| 16 | #define EI_MAG3 3 |
| 17 | #define EI_CLASS 4 |
| 18 | #define EI_DATA 5 |
| 19 | #define EI_VERSION 6 |
| 20 | #define EI_PAD 7 |
| 21 | |
| 22 | #define ELFMAG0 0x7F |
| 23 | #define ELFMAG1 'E' |
| 24 | #define ELFMAG2 'L' |
| 25 | #define ELFMAG3 'F' |
| 26 | |
| 27 | #define ELFCLASSNONE 0 |
| 28 | #define ELFCLASS32 1 |
| 29 | #define ELFCLASS64 2 |
| 30 | |
| 31 | #define ELFDATANONE 0 |
| 32 | #define ELFDATA2LSB 1 |
| 33 | #define ELFDATA2MSB 2 |
| 34 | |
| 35 | #define ET_NONE 0 |
| 36 | #define ET_REL 1 |
| 37 | #define ET_EXEC 2 |
| 38 | #define ET_DYN 3 |
| 39 | #define ET_CORE 4 |
| 40 | |
| 41 | #define EM_MIPS 8 |
| 42 | |
| 43 | #define EV_NONE 0 |
| 44 | #define EV_CURRENT 1 |
| 45 | |
| 46 | #define PT_NULL 0 |
| 47 | #define PT_LOAD 1 |
| 48 | |
| 49 | typedef struct { |
| 50 | unsigned char e_ident[EI_NIDENT]; |
| 51 | Elf32_Half e_type; |
| 52 | Elf32_Half e_machine; |
| 53 | Elf32_Word e_version; |
| 54 | Elf32_Addr e_entry; |
| 55 | Elf32_Off e_phoff; |
| 56 | Elf32_Off e_shoff; |
| 57 | Elf32_Word e_flags; |
| 58 | Elf32_Half e_ehsize; |
| 59 | Elf32_Half e_phentsize; |
| 60 | Elf32_Half e_phnum; |
| 61 | Elf32_Half e_shentsize; |
| 62 | Elf32_Half e_shnum; |
| 63 | Elf32_Half e_shstrndx; |
| 64 | } Elf32_Ehdr; |
| 65 | |
| 66 | typedef struct { |
| 67 | Elf32_Word p_type; |
| 68 | Elf32_Off p_offset; |
| 69 | Elf32_Addr p_vaddr; |
| 70 | Elf32_Addr p_paddr; |
| 71 | Elf32_Word p_filesz; |
| 72 | Elf32_Word p_memsz; |
| 73 | Elf32_Word p_flags; |
| 74 | Elf32_Word p_align; |
| 75 | } Elf32_Phdr; |
| 76 | |
| 77 | #endif |
| 78 | |
| 79 |
