elf.h (693B)
1 #ifndef _ELF_H_ 2 #define _ELF_H_ 1 3 4 #define ELF_MAGIC 0x464C457F /* little endian */ 5 6 struct Elf32 { 7 uint32_t e_magic; 8 uint8_t e_elf[12]; 9 uint16_t e_type; 10 uint16_t e_machine; 11 uint32_t e_version; 12 uint32_t e_entry; 13 uint32_t e_phoff; 14 uint32_t e_shoff; 15 uint32_t e_flags; 16 uint16_t e_ehsize; 17 uint16_t e_phentsize; 18 uint16_t e_phnum; 19 uint16_t e_shentsize; 20 uint16_t e_shnum; 21 uint16_t e_shstrndx; 22 }; 23 24 #define ELF_PROG_LOAD 1 25 #define ELF_PROG_FLAG_EXEC 1 26 #define ELF_PROG_FLAG_WRITE 2 27 #define ELF_PROG_FLAG_READ 4 28 29 struct Proghdr { 30 uint32_t p_type; 31 uint32_t p_offset; 32 uint32_t p_va; 33 uint32_t p_pa; 34 uint32_t p_filesz; 35 uint32_t p_memsz; 36 uint32_t p_flags; 37 uint32_t p_align; 38 }; 39 40 #endif