Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 11 | Rev 16 | ||
|---|---|---|---|
| Line -... | Line 1... | ||
| - | 1 | // Hex Workshop structures library | |
| - | 2 | ||
| 1 | #include "standard-types.hsl" | 3 | #include "standard-types.hsl" | 
| 2 | 4 | ||
| 3 | #pragma displayname("QNX Neutrino IFS in-kernel filesystem structures") | 5 | #pragma displayname("QNX Neutrino IFS in-kernel filesystem structures") | 
| 4 | #pragma byteorder(little_endian) | 6 | #pragma byteorder(little_endian) | 
| 5 | 7 | ||
| Line 120... | Line 122... | ||
| 120 | } image_trailer_t; | 122 | } image_trailer_t; | 
| 121 | 123 | ||
| 122 | 124 | ||
| 123 | 125 | ||
| 124 | 126 | ||
| 125 | - | ||
| 126 | - | ||
| 127 | // Executable and Linkable Format master header structure type definition | - | |
| 128 | typedef struct elf32_header_s | - | |
| 129 | { | - | |
| 130 | unsigned char magic[4]; // offset 0: "\x7f" + "ELF" | - | |
| 131 | #pragma verify match_var_int("magic[0]", "0x7f") | - | |
| 132 | #pragma verify match_var_int("magic[1]", "0x45") | - | |
| 133 | #pragma verify match_var_int("magic[2]", "0x4c") | - | |
| 134 | #pragma verify match_var_int("magic[3]", "0x46") | - | |
| 135 | unsigned char platform_size; // offset 4: 1 = 32-bit, 2 = 64-bit | - | |
| 136 | #pragma verify match_var_int("platform_size", "1") | - | |
| 137 | unsigned char endianness; // offset 5: 1 = little endian, 2 = big endian | - | |
| 138 | unsigned char header_version; // offset 6: typically 1 | - | |
| 139 | unsigned char os_abi; // offset 7: 0 = SysV, 1 = HP/UX, 2 = NetBSD, 3 = Linux, 4 = GNU/Hurd, 6 = Solaris, 7 = AIX, 8 = IRIX, 9 = FreeBSD, 10 = Tru64, 11 = Novell, 12 = OpenBSD, 13 = OpenVMS, 14 = NonStop kernel, 15 = AROS, 16 = FenixOS, 17 = Nuxi CloudABI, 18 = OpenVOS | - | |
| 140 | unsigned char spare[8]; // offset 8: zeroes | - | |
| 141 | unsigned __int16 type; // offset 16: 1 = relocatable, 2 = executable, 3 = shared, 4 = core dump | - | |
| 142 | unsigned __int16 instruction_set; // offset 18: 2 = Sparc, 3 = i386, 8 = MIPS, 20 = PowerPC, 40 = ARM, 42 = SuperH, 50 = IA-64, 62 = x86_64, 183 = AArch64, 243 = RISC-V | - | |
| 143 | unsigned __int32 elf_version; // offset 20: typically 1 | - | |
| 144 | unsigned __int32 entrypoint_offset; // offset 24: offset to program entrypoint | - | |
| 145 | unsigned __int32 program_header_table_offset; // offset 28: offset to program header table | - | |
| 146 | unsigned __int32 section_header_table_offset; // offset 32: offset to section header table | - | |
| 147 | unsigned __int32 flags; // offset 36: flags (architecture-dependent, none for x86) | - | |
| 148 | unsigned __int16 header_size; // offset 40: size of ELF header, 52 for 32-bit ELF and 64 for 64-bit ELF -- DO NOT USE sizeof() ON THE elf_header_s STRUCT BECAUSE OF THE UNION! WRITE THE CORRECT SIZE YOURSELF! | - | |
| 149 | unsigned __int16 program_header_item_size; // offset 42: size of an entry in the program header table | - | |
| 150 | unsigned __int16 program_header_table_len; // offset 44: number of entries in the program header table | - | |
| 151 | unsigned __int16 section_header_item_size; // offset 46: size of an entry in the section header table | - | |
| 152 | unsigned __int16 section_header_table_len; // offset 48: number of entries in the section header table | - | |
| 153 | unsigned __int16 section_header_names_idx; // offset 50: index of the entry in the section header table that contains the section names | - | |
| 154 | } elf32_header_t; | - | |
| 155 | - | ||
| 156 | typedef struct elf64_header_s | - | |
| 157 | { | - | |
| 158 | unsigned char magic[4]; // offset 0: "\x07" + "ELF" | - | |
| 159 | #pragma verify match_var_int("magic[0]", "0x7f") | - | |
| 160 | #pragma verify match_var_int("magic[1]", "0x45") | - | |
| 161 | #pragma verify match_var_int("magic[2]", "0x4c") | - | |
| 162 | #pragma verify match_var_int("magic[3]", "0x46") | - | |
| 163 | unsigned char platform_size; // offset 4: 1 = 32-bit, 2 = 64-bit | - | |
| 164 | #pragma verify match_var_int("platform_size", "2") | - | |
| 165 | unsigned char endianness; // offset 5: 1 = little endian, 2 = big endian | - | |
| 166 | unsigned char header_version; // offset 6: typically 1 | - | |
| 167 | unsigned char os_abi; // offset 7: 0 = SysV, 1 = HP/UX, 2 = NetBSD, 3 = Linux, 4 = GNU/Hurd, 6 = Solaris, 7 = AIX, 8 = IRIX, 9 = FreeBSD, 10 = Tru64, 11 = Novell, 12 = OpenBSD, 13 = OpenVMS, 14 = NonStop kernel, 15 = AROS, 16 = FenixOS, 17 = Nuxi CloudABI, 18 = OpenVOS | - | |
| 168 | unsigned char spare[8]; // offset 8: zeroes | - | |
| 169 | unsigned __int16 type; // offset 16: 1 = relocatable, 2 = executable, 3 = shared, 4 = core dump | - | |
| 170 | unsigned __int16 instruction_set; // offset 18: 2 = Sparc, 3 = i386, 8 = MIPS, 20 = PowerPC, 40 = ARM, 42 = SuperH, 50 = IA-64, 62 = x86_64, 183 = AArch64, 243 = RISC-V | - | |
| 171 | unsigned __int32 elf_version; // offset 20: typically 1 | - | |
| 172 | unsigned __int64 entrypoint_offset; // offset 24: program entry offset | - | |
| 173 | unsigned __int64 program_header_table_offset; // offset 32: offset to program header table | - | |
| 174 | unsigned __int64 section_header_table_offset; // offset 40: offset to section header table | - | |
| 175 | unsigned __int32 flags; // offset 48: flags (architecture-dependent, none for x86) | - | |
| 176 | unsigned __int16 header_size; // offset 52: size of ELF header, 52 for 32-bit ELF and 64 for 64-bit ELF | - | |
| 177 | unsigned __int16 program_header_item_size; // offset 54: size of an entry in the program header table | - | |
| 178 | unsigned __int16 program_header_table_len; // offset 56: number of entries in the program header table | - | |
| 179 | unsigned __int16 section_header_item_size; // offset 58: size of an entry in the section header table | - | |
| 180 | unsigned __int16 section_header_table_len; // offset 60: number of entries in the section header table | - | |
| 181 | unsigned __int16 section_header_names_idx; // offset 62: index of the entry in the section header table that contains the section names | - | |
| 182 | } elf64_header_t; | - | |
| 183 | 127 | ||
| 184 | 128 | ||
| 185 | // Executable and Linkable Format program header structure type definition | 129 | // Executable and Linkable Format program header structure type definition | 
| 186 | typedef struct elf32_program_header_s | 130 | typedef struct elf32_program_header_s | 
| 187 | { | 131 | { | 
| Line 245... | Line 189... | ||
| 245 | typedef struct elf64_dynamic_section_entry_s | 189 | typedef struct elf64_dynamic_section_entry_s | 
| 246 | { | 190 | { | 
| 247 | __int64 tag; // dynamic entry type (one of ELF_DT_xxx #defines) | 191 | __int64 tag; // dynamic entry type (one of ELF_DT_xxx #defines) | 
| 248 | unsigned __int64 integer_or_pointer; // value as intege | 192 | unsigned __int64 integer_or_pointer; // value as intege | 
| 249 | } elf64_dynamic_section_entry_t; | 193 | } elf64_dynamic_section_entry_t; | 
| - | 194 | ||
| - | 195 | ||
| - | 196 | // Executable and Linkable Format master header structure type definition | |
| - | 197 | typedef struct elf32_header_s | |
| - | 198 | { | |
| - | 199 | unsigned __int32 magic; // offset 0: "\x7f" + "ELF" | |
| - | 200 | unsigned char platform_size; // offset 4: 1 = 32-bit, 2 = 64-bit | |
| - | 201 | __verify((magic == __byteflip32 (0x7f454c46)) && (platform_size == 1)); | |
| - | 202 | unsigned char endianness; // offset 5: 1 = little endian, 2 = big endian | |
| - | 203 | unsigned char header_version; // offset 6: typically 1 | |
| - | 204 | unsigned char os_abi; // offset 7: 0 = SysV, 1 = HP/UX, 2 = NetBSD, 3 = Linux, 4 = GNU/Hurd, 6 = Solaris, 7 = AIX, 8 = IRIX, 9 = FreeBSD, 10 = Tru64, 11 = Novell, 12 = OpenBSD, 13 = OpenVMS, 14 = NonStop kernel, 15 = AROS, 16 = FenixOS, 17 = Nuxi CloudABI, 18 = OpenVOS | |
| - | 205 | unsigned char spare[8]; // offset 8: zeroes | |
| - | 206 | unsigned __int16 type; // offset 16: 1 = relocatable, 2 = executable, 3 = shared, 4 = core dump | |
| - | 207 | unsigned __int16 instruction_set; // offset 18: 2 = Sparc, 3 = i386, 8 = MIPS, 20 = PowerPC, 40 = ARM, 42 = SuperH, 50 = IA-64, 62 = x86_64, 183 = AArch64, 243 = RISC-V | |
| - | 208 | unsigned __int32 elf_version; // offset 20: typically 1 | |
| - | 209 | unsigned __int32 entrypoint_offset; // offset 24: offset to program entrypoint | |
| - | 210 | unsigned __int32 program_header_table_offset; // offset 28: offset to program header table | |
| - | 211 | unsigned __int32 section_header_table_offset; // offset 32: offset to section header table | |
| - | 212 | unsigned __int32 flags; // offset 36: flags (architecture-dependent, none for x86) | |
| - | 213 | unsigned __int16 header_size; // offset 40: size of ELF header, 52 for 32-bit ELF and 64 for 64-bit ELF -- DO NOT USE sizeof() ON THE elf_header_s STRUCT BECAUSE OF THE UNION! WRITE THE CORRECT SIZE YOURSELF! | |
| - | 214 | unsigned __int16 program_header_item_size; // offset 42: size of an entry in the program header table | |
| - | 215 | unsigned __int16 program_header_table_len; // offset 44: number of entries in the program header table | |
| - | 216 | unsigned __int16 section_header_item_size; // offset 46: size of an entry in the section header table | |
| - | 217 | unsigned __int16 section_header_table_len; // offset 48: number of entries in the section header table | |
| - | 218 | unsigned __int16 section_header_names_idx; // offset 50: index of the entry in the section header table that contains the section names | |
| - | 219 | ||
| - | 220 | elf32_program_header_t program_headers[program_header_table_len]; | |
| - | 221 | } elf32_header_t; | |
| - | 222 | ||
| - | 223 | typedef struct elf64_header_s | |
| - | 224 | { | |
| - | 225 | unsigned __int32 magic; // offset 0: "\x7f" + "ELF" | |
| - | 226 | unsigned char platform_size; // offset 4: 1 = 32-bit, 2 = 64-bit | |
| - | 227 | __verify((magic == __byteflip32 (0x7f454c46)) && (platform_size == 2)); | |
| - | 228 | unsigned char endianness; // offset 5: 1 = little endian, 2 = big endian | |
| - | 229 | unsigned char header_version; // offset 6: typically 1 | |
| - | 230 | unsigned char os_abi; // offset 7: 0 = SysV, 1 = HP/UX, 2 = NetBSD, 3 = Linux, 4 = GNU/Hurd, 6 = Solaris, 7 = AIX, 8 = IRIX, 9 = FreeBSD, 10 = Tru64, 11 = Novell, 12 = OpenBSD, 13 = OpenVMS, 14 = NonStop kernel, 15 = AROS, 16 = FenixOS, 17 = Nuxi CloudABI, 18 = OpenVOS | |
| - | 231 | unsigned char spare[8]; // offset 8: zeroes | |
| - | 232 | unsigned __int16 type; // offset 16: 1 = relocatable, 2 = executable, 3 = shared, 4 = core dump | |
| - | 233 | unsigned __int16 instruction_set; // offset 18: 2 = Sparc, 3 = i386, 8 = MIPS, 20 = PowerPC, 40 = ARM, 42 = SuperH, 50 = IA-64, 62 = x86_64, 183 = AArch64, 243 = RISC-V | |
| - | 234 | unsigned __int32 elf_version; // offset 20: typically 1 | |
| - | 235 | unsigned __int64 entrypoint_offset; // offset 24: program entry offset | |
| - | 236 | unsigned __int64 program_header_table_offset; // offset 32: offset to program header table | |
| - | 237 | unsigned __int64 section_header_table_offset; // offset 40: offset to section header table | |
| - | 238 | unsigned __int32 flags; // offset 48: flags (architecture-dependent, none for x86) | |
| - | 239 | unsigned __int16 header_size; // offset 52: size of ELF header, 52 for 32-bit ELF and 64 for 64-bit ELF | |
| - | 240 | unsigned __int16 program_header_item_size; // offset 54: size of an entry in the program header table | |
| - | 241 | unsigned __int16 program_header_table_len; // offset 56: number of entries in the program header table | |
| - | 242 | unsigned __int16 section_header_item_size; // offset 58: size of an entry in the section header table | |
| - | 243 | unsigned __int16 section_header_table_len; // offset 60: number of entries in the section header table | |
| - | 244 | unsigned __int16 section_header_names_idx; // offset 62: index of the entry in the section header table that contains the section names | |
| - | 245 | ||
| - | 246 | elf64_program_header_t program_headers[program_header_table_len]; | |
| - | 247 | } elf64_header_t; | |