kernel/elf.h
42 lines
1// Format of an ELF executable file23#define ELF_MAGIC 0x464C457FU // "\x7FELF" in little endian45// File header6struct elfhdr {7 uint magic; // must equal ELF_MAGIC8 uchar elf[12];9 ushort type;10 ushort machine;11 uint version;12 uint64 entry;13 uint64 phoff;14 uint64 shoff;15 uint flags;16 ushort ehsize;17 ushort phentsize;18 ushort phnum;19 ushort shentsize;20 ushort shnum;21 ushort shstrndx;22};2324// Program section header25struct proghdr {26 uint32 type;27 uint32 flags;28 uint64 off;29 uint64 vaddr;30 uint64 paddr;31 uint64 filesz;32 uint64 memsz;33 uint64 align;34};3536// Values for Proghdr type37#define ELF_PROG_LOAD 13839// Flag bits for Proghdr flags40#define ELF_PROG_FLAG_EXEC 141#define ELF_PROG_FLAG_WRITE 242#define ELF_PROG_FLAG_READ 443