4 #define EI_NIDENT 16 /* Size of e_ident array. */
6 /* Values for e_type. */
7 #define ET_NONE 0 /* No file type */
8 #define ET_REL 1 /* Relocatable file */
9 #define ET_EXEC 2 /* Executable file */
10 #define ET_DYN 3 /* Shared object file */
11 #define ET_CORE 4 /* Core file */
13 /* Values for e_machine (architecute). */
14 #define EM_NONE 0 /* No machine */
15 #define EM_M32 1 /* AT&T WE 32100 */
16 #define EM_SPARC 2 /* SUN SPARC */
17 #define EM_386 3 /* Intel 80386+ */
18 #define EM_68K 4 /* Motorola m68k family */
19 #define EM_88K 5 /* Motorola m88k family */
20 #define EM_486 6 /* Perhaps disused */
21 #define EM_860 7 /* Intel 80860 */
22 #define EM_MIPS 8 /* MIPS R3000 big-endian */
23 #define EM_S370 9 /* IBM System/370 */
24 #define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
26 #define EM_PARISC 15 /* HPPA */
27 #define EM_VPP500 17 /* Fujitsu VPP500 */
28 #define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
29 #define EM_960 19 /* Intel 80960 */
30 #define EM_PPC 20 /* PowerPC */
31 #define EM_PPC64 21 /* PowerPC 64-bit */
32 #define EM_S390 22 /* IBM S390 */
34 #define EM_V800 36 /* NEC V800 series */
35 #define EM_FR20 37 /* Fujitsu FR20 */
36 #define EM_RH32 38 /* TRW RH-32 */
37 #define EM_RCE 39 /* Motorola RCE */
38 #define EM_ARM 40 /* ARM */
39 #define EM_FAKE_ALPHA 41 /* Digital Alpha */
40 #define EM_SH 42 /* Hitachi SH */
41 #define EM_SPARCV9 43 /* SPARC v9 64-bit */
42 #define EM_TRICORE 44 /* Siemens Tricore */
43 #define EM_ARC 45 /* Argonaut RISC Core */
44 #define EM_H8_300 46 /* Hitachi H8/300 */
45 #define EM_H8_300H 47 /* Hitachi H8/300H */
46 #define EM_H8S 48 /* Hitachi H8S */
47 #define EM_H8_500 49 /* Hitachi H8/500 */
48 #define EM_IA_64 50 /* Intel Merced */
49 #define EM_MIPS_X 51 /* Stanford MIPS-X */
50 #define EM_COLDFIRE 52 /* Motorola Coldfire */
51 #define EM_68HC12 53 /* Motorola M68HC12 */
52 #define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
53 #define EM_PCP 55 /* Siemens PCP */
54 #define EM_NCPU 56 /* Sony nCPU embeeded RISC */
55 #define EM_NDR1 57 /* Denso NDR1 microprocessor */
56 #define EM_STARCORE 58 /* Motorola Start*Core processor */
57 #define EM_ME16 59 /* Toyota ME16 processor */
58 #define EM_ST100 60 /* STMicroelectronic ST100 processor */
59 #define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
60 #define EM_X86_64 62 /* AMD x86-64 architecture */
61 #define EM_PDSP 63 /* Sony DSP Processor */
63 #define EM_FX66 66 /* Siemens FX66 microcontroller */
64 #define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
65 #define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
66 #define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
67 #define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
68 #define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
69 #define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
70 #define EM_SVX 73 /* Silicon Graphics SVx */
71 #define EM_AT19 74 /* STMicroelectronics ST19 8 bit mc */
72 #define EM_VAX 75 /* Digital VAX */
73 #define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
74 #define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded processor */
75 #define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
76 #define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
77 #define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
78 #define EM_HUANY 81 /* Harvard University machine-independent object files */
79 #define EM_PRISM 82 /* SiTera Prism */
80 #define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
81 #define EM_FR30 84 /* Fujitsu FR30 */
82 #define EM_D10V 85 /* Mitsubishi D10V */
83 #define EM_D30V 86 /* Mitsubishi D30V */
84 #define EM_V850 87 /* NEC v850 */
85 #define EM_M32R 88 /* Mitsubishi M32R */
86 #define EM_MN10300 89 /* Matsushita MN10300 */
87 #define EM_MN10200 90 /* Matsushita MN10200 */
88 #define EM_PJ 91 /* picoJava */
89 #define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
90 #define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
91 #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
94 /* Values for p_type. */
95 #define PT_NULL 0 /* Unused entry. */
96 #define PT_LOAD 1 /* Loadable segment. */
97 #define PT_DYNAMIC 2 /* Dynamic linking information segment. */
98 #define PT_INTERP 3 /* Pathname of interpreter. */
99 #define PT_NOTE 4 /* Auxiliary information. */
100 #define PT_SHLIB 5 /* Reserved (not used). */
101 #define PT_PHDR 6 /* Location of program header itself. */
103 /* Values for p_flags. */
104 #define PF_X 0x1 /* Executable. */
105 #define PF_W 0x2 /* Writable. */
106 #define PF_R 0x4 /* Readable. */
109 #define ELF_PROGRAM_RETURNS_BIT 0x8000000 /* e_flags bit 31 */
123 #define ELFMAG "\177ELF"
125 #define EI_CLASS 4 /* File class byte index */
126 #define ELFCLASSNONE 0 /* Invalid class */
127 #define ELFCLASS32 1 /* 32-bit objects */
128 #define ELFCLASS64 2 /* 64-bit objects */
130 #define EI_DATA 5 /* Data encodeing byte index */
131 #define ELFDATANONE 0 /* Invalid data encoding */
132 #define ELFDATA2LSB 1 /* 2's complement little endian */
133 #define ELFDATA2MSB 2 /* 2's complement big endian */
135 #define EI_VERSION 6 /* File version byte index */
136 /* Value must be EV_CURRENT */
138 #define EV_NONE 0 /* Invalid ELF Version */
139 #define EV_CURRENT 1 /* Current version */
141 #define ELF32_PHDR_SIZE (8*4) /* Size of an elf program header */
145 * ELF definitions common to all 32-bit architectures.
148 typedef uint32_t Elf32_Addr
;
149 typedef uint16_t Elf32_Half
;
150 typedef uint32_t Elf32_Off
;
151 typedef int32_t Elf32_Sword
;
152 typedef uint32_t Elf32_Word
;
153 typedef uint32_t Elf32_Size
;
155 typedef uint64_t Elf64_Addr
;
156 typedef uint16_t Elf64_Half
;
157 typedef uint64_t Elf64_Off
;
158 typedef int32_t Elf64_Sword
;
159 typedef uint32_t Elf64_Word
;
160 typedef uint64_t Elf64_Size
;
166 unsigned char e_ident
[EI_NIDENT
]; /* File identification. */
167 Elf32_Half e_type
; /* File type. */
168 Elf32_Half e_machine
; /* Machine architecture. */
169 Elf32_Word e_version
; /* ELF format version. */
170 Elf32_Addr e_entry
; /* Entry point. */
171 Elf32_Off e_phoff
; /* Program header file offset. */
172 Elf32_Off e_shoff
; /* Section header file offset. */
173 Elf32_Word e_flags
; /* Architecture-specific flags. */
174 Elf32_Half e_ehsize
; /* Size of ELF header in bytes. */
175 Elf32_Half e_phentsize
; /* Size of program header entry. */
176 Elf32_Half e_phnum
; /* Number of program header entries. */
177 Elf32_Half e_shentsize
; /* Size of section header entry. */
178 Elf32_Half e_shnum
; /* Number of section header entries. */
179 Elf32_Half e_shstrndx
; /* Section name strings section. */
183 unsigned char e_ident
[EI_NIDENT
]; /* File identification. */
184 Elf64_Half e_type
; /* File type. */
185 Elf64_Half e_machine
; /* Machine architecture. */
186 Elf64_Word e_version
; /* ELF format version. */
187 Elf64_Addr e_entry
; /* Entry point. */
188 Elf64_Off e_phoff
; /* Program header file offset. */
189 Elf64_Off e_shoff
; /* Section header file offset. */
190 Elf64_Word e_flags
; /* Architecture-specific flags. */
191 Elf64_Half e_ehsize
; /* Size of ELF header in bytes. */
192 Elf64_Half e_phentsize
; /* Size of program header entry. */
193 Elf64_Half e_phnum
; /* Number of program header entries. */
194 Elf64_Half e_shentsize
; /* Size of section header entry. */
195 Elf64_Half e_shnum
; /* Number of section header entries. */
196 Elf64_Half e_shstrndx
; /* Section name strings section. */
203 Elf32_Word p_type
; /* Entry type. */
204 Elf32_Off p_offset
; /* File offset of contents. */
205 Elf32_Addr p_vaddr
; /* Virtual address (not used). */
206 Elf32_Addr p_paddr
; /* Physical address. */
207 Elf32_Size p_filesz
; /* Size of contents in file. */
208 Elf32_Size p_memsz
; /* Size of contents in memory. */
209 Elf32_Word p_flags
; /* Access permission flags. */
210 Elf32_Size p_align
; /* Alignment in memory and file. */
214 Elf64_Word p_type
; /* Entry type. */
215 Elf64_Word p_flags
; /* Access permission flags. */
216 Elf64_Off p_offset
; /* File offset of contents. */
217 Elf64_Addr p_vaddr
; /* Virtual address (not used). */
218 Elf64_Addr p_paddr
; /* Physical address. */
219 Elf64_Size p_filesz
; /* Size of contents in file. */
220 Elf64_Size p_memsz
; /* Size of contents in memory. */
221 Elf64_Size p_align
; /* Alignment in memory and file. */
224 /* Standardized Elf image notes for booting... The name for all of these is ELFBoot */
227 /* ELF Defines for the current architecture */
228 #include "bits/elf.h"
230 #endif /* ASSEMBLY */
232 #include "elf_boot.h"