Linux Audio

Check our new training course

Loading...
v5.14.15
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright 2011 Red Hat, Inc.
  4 * All rights reserved.
  5 *
  6 * Author(s): Peter Jones <pjones@redhat.com>
  7 */
  8#ifndef __LINUX_PE_H
  9#define __LINUX_PE_H
 10
 11#include <linux/types.h>
 12
 13/*
 14 * Linux EFI stub v1.0 adds the following functionality:
 15 * - Loading initrd from the LINUX_EFI_INITRD_MEDIA_GUID device path,
 16 * - Loading/starting the kernel from firmware that targets a different
 17 *   machine type, via the entrypoint exposed in the .compat PE/COFF section.
 18 *
 19 * The recommended way of loading and starting v1.0 or later kernels is to use
 20 * the LoadImage() and StartImage() EFI boot services, and expose the initrd
 21 * via the LINUX_EFI_INITRD_MEDIA_GUID device path.
 22 *
 23 * Versions older than v1.0 support initrd loading via the image load options
 24 * (using initrd=, limited to the volume from which the kernel itself was
 25 * loaded), or via arch specific means (bootparams, DT, etc).
 26 *
 27 * On x86, LoadImage() and StartImage() can be omitted if the EFI handover
 28 * protocol is implemented, which can be inferred from the version,
 29 * handover_offset and xloadflags fields in the bootparams structure.
 30 */
 31#define LINUX_EFISTUB_MAJOR_VERSION		0x1
 32#define LINUX_EFISTUB_MINOR_VERSION		0x0
 33
 34#define MZ_MAGIC	0x5a4d	/* "MZ" */
 35
 36#define PE_MAGIC		0x00004550	/* "PE\0\0" */
 37#define PE_OPT_MAGIC_PE32	0x010b
 38#define PE_OPT_MAGIC_PE32_ROM	0x0107
 39#define PE_OPT_MAGIC_PE32PLUS	0x020b
 40
 41/* machine type */
 42#define	IMAGE_FILE_MACHINE_UNKNOWN	0x0000
 43#define	IMAGE_FILE_MACHINE_AM33		0x01d3
 44#define	IMAGE_FILE_MACHINE_AMD64	0x8664
 45#define	IMAGE_FILE_MACHINE_ARM		0x01c0
 46#define	IMAGE_FILE_MACHINE_ARMV7	0x01c4
 47#define	IMAGE_FILE_MACHINE_ARM64	0xaa64
 48#define	IMAGE_FILE_MACHINE_EBC		0x0ebc
 49#define	IMAGE_FILE_MACHINE_I386		0x014c
 50#define	IMAGE_FILE_MACHINE_IA64		0x0200
 51#define	IMAGE_FILE_MACHINE_M32R		0x9041
 52#define	IMAGE_FILE_MACHINE_MIPS16	0x0266
 53#define	IMAGE_FILE_MACHINE_MIPSFPU	0x0366
 54#define	IMAGE_FILE_MACHINE_MIPSFPU16	0x0466
 55#define	IMAGE_FILE_MACHINE_POWERPC	0x01f0
 56#define	IMAGE_FILE_MACHINE_POWERPCFP	0x01f1
 57#define	IMAGE_FILE_MACHINE_R4000	0x0166
 58#define	IMAGE_FILE_MACHINE_RISCV32	0x5032
 59#define	IMAGE_FILE_MACHINE_RISCV64	0x5064
 60#define	IMAGE_FILE_MACHINE_RISCV128	0x5128
 61#define	IMAGE_FILE_MACHINE_SH3		0x01a2
 62#define	IMAGE_FILE_MACHINE_SH3DSP	0x01a3
 63#define	IMAGE_FILE_MACHINE_SH3E		0x01a4
 64#define	IMAGE_FILE_MACHINE_SH4		0x01a6
 65#define	IMAGE_FILE_MACHINE_SH5		0x01a8
 66#define	IMAGE_FILE_MACHINE_THUMB	0x01c2
 67#define	IMAGE_FILE_MACHINE_WCEMIPSV2	0x0169
 68
 69/* flags */
 70#define IMAGE_FILE_RELOCS_STRIPPED           0x0001
 71#define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002
 72#define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004
 73#define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008
 74#define IMAGE_FILE_AGGRESSIVE_WS_TRIM        0x0010
 75#define IMAGE_FILE_LARGE_ADDRESS_AWARE       0x0020
 76#define IMAGE_FILE_16BIT_MACHINE             0x0040
 77#define IMAGE_FILE_BYTES_REVERSED_LO         0x0080
 78#define IMAGE_FILE_32BIT_MACHINE             0x0100
 79#define IMAGE_FILE_DEBUG_STRIPPED            0x0200
 80#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP   0x0400
 81#define IMAGE_FILE_NET_RUN_FROM_SWAP         0x0800
 82#define IMAGE_FILE_SYSTEM                    0x1000
 83#define IMAGE_FILE_DLL                       0x2000
 84#define IMAGE_FILE_UP_SYSTEM_ONLY            0x4000
 85#define IMAGE_FILE_BYTES_REVERSED_HI         0x8000
 86
 87#define IMAGE_FILE_OPT_ROM_MAGIC	0x107
 88#define IMAGE_FILE_OPT_PE32_MAGIC	0x10b
 89#define IMAGE_FILE_OPT_PE32_PLUS_MAGIC	0x20b
 90
 91#define IMAGE_SUBSYSTEM_UNKNOWN			 0
 92#define IMAGE_SUBSYSTEM_NATIVE			 1
 93#define IMAGE_SUBSYSTEM_WINDOWS_GUI		 2
 94#define IMAGE_SUBSYSTEM_WINDOWS_CUI		 3
 95#define IMAGE_SUBSYSTEM_POSIX_CUI		 7
 96#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI		 9
 97#define IMAGE_SUBSYSTEM_EFI_APPLICATION		10
 98#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER	11
 99#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER	12
100#define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE		13
101#define IMAGE_SUBSYSTEM_XBOX			14
102
103#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE          0x0040
104#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY       0x0080
105#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT             0x0100
106#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION           0x0200
107#define IMAGE_DLLCHARACTERISTICS_NO_SEH                 0x0400
108#define IMAGE_DLLCHARACTERISTICS_NO_BIND                0x0800
109#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER             0x2000
110#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE  0x8000
111
112/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
113#define IMAGE_SCN_RESERVED_0	0x00000001
114#define IMAGE_SCN_RESERVED_1	0x00000002
115#define IMAGE_SCN_RESERVED_2	0x00000004
116#define IMAGE_SCN_TYPE_NO_PAD	0x00000008 /* don't pad - obsolete */
117#define IMAGE_SCN_RESERVED_3	0x00000010
118#define IMAGE_SCN_CNT_CODE	0x00000020 /* .text */
119#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */
120#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
121#define IMAGE_SCN_LNK_OTHER	0x00000100 /* reserved */
122#define IMAGE_SCN_LNK_INFO	0x00000200 /* .drectve comments */
123#define IMAGE_SCN_RESERVED_4	0x00000400
124#define IMAGE_SCN_LNK_REMOVE	0x00000800 /* .o only - scn to be rm'd*/
125#define IMAGE_SCN_LNK_COMDAT	0x00001000 /* .o only - COMDAT data */
126#define IMAGE_SCN_RESERVED_5	0x00002000 /* spec omits this */
127#define IMAGE_SCN_RESERVED_6	0x00004000 /* spec omits this */
128#define IMAGE_SCN_GPREL		0x00008000 /* global pointer referenced data */
129/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
130#define IMAGE_SCN_MEM_PURGEABLE	0x00010000 /* reserved for "future" use */
131#define IMAGE_SCN_16BIT		0x00020000 /* reserved for "future" use */
132#define IMAGE_SCN_LOCKED	0x00040000 /* reserved for "future" use */
133#define IMAGE_SCN_PRELOAD	0x00080000 /* reserved for "future" use */
134/* and here they just stuck a 1-byte integer in the middle of a bitfield */
135#define IMAGE_SCN_ALIGN_1BYTES	0x00100000 /* it does what it says on the box */
136#define IMAGE_SCN_ALIGN_2BYTES	0x00200000
137#define IMAGE_SCN_ALIGN_4BYTES	0x00300000
138#define IMAGE_SCN_ALIGN_8BYTES	0x00400000
139#define IMAGE_SCN_ALIGN_16BYTES	0x00500000
140#define IMAGE_SCN_ALIGN_32BYTES	0x00600000
141#define IMAGE_SCN_ALIGN_64BYTES	0x00700000
142#define IMAGE_SCN_ALIGN_128BYTES 0x00800000
143#define IMAGE_SCN_ALIGN_256BYTES 0x00900000
144#define IMAGE_SCN_ALIGN_512BYTES 0x00a00000
145#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
146#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
147#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
148#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
149#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
150#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
151#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */
152#define IMAGE_SCN_MEM_NOT_PAGED	0x08000000 /* not pageable */
153#define IMAGE_SCN_MEM_SHARED	0x10000000 /* can be shared */
154#define IMAGE_SCN_MEM_EXECUTE	0x20000000 /* can be executed as code */
155#define IMAGE_SCN_MEM_READ	0x40000000 /* readable */
156#define IMAGE_SCN_MEM_WRITE	0x80000000 /* writeable */
157
158#define IMAGE_DEBUG_TYPE_CODEVIEW	2
159
160#ifndef __ASSEMBLY__
161
162struct mz_hdr {
163	uint16_t magic;		/* MZ_MAGIC */
164	uint16_t lbsize;	/* size of last used block */
165	uint16_t blocks;	/* pages in file, 0x3 */
166	uint16_t relocs;	/* relocations */
167	uint16_t hdrsize;	/* header size in "paragraphs" */
168	uint16_t min_extra_pps;	/* .bss */
169	uint16_t max_extra_pps;	/* runtime limit for the arena size */
170	uint16_t ss;		/* relative stack segment */
171	uint16_t sp;		/* initial %sp register */
172	uint16_t checksum;	/* word checksum */
173	uint16_t ip;		/* initial %ip register */
174	uint16_t cs;		/* initial %cs relative to load segment */
175	uint16_t reloc_table_offset;	/* offset of the first relocation */
176	uint16_t overlay_num;	/* overlay number.  set to 0. */
177	uint16_t reserved0[4];	/* reserved */
178	uint16_t oem_id;	/* oem identifier */
179	uint16_t oem_info;	/* oem specific */
180	uint16_t reserved1[10];	/* reserved */
181	uint32_t peaddr;	/* address of pe header */
182	char     message[];	/* message to print */
183};
184
185struct mz_reloc {
186	uint16_t offset;
187	uint16_t segment;
188};
189
190struct pe_hdr {
191	uint32_t magic;		/* PE magic */
192	uint16_t machine;	/* machine type */
193	uint16_t sections;	/* number of sections */
194	uint32_t timestamp;	/* time_t */
195	uint32_t symbol_table;	/* symbol table offset */
196	uint32_t symbols;	/* number of symbols */
197	uint16_t opt_hdr_size;	/* size of optional header */
198	uint16_t flags;		/* flags */
199};
200
201/* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
202 * work right.  vomit. */
203struct pe32_opt_hdr {
204	/* "standard" header */
205	uint16_t magic;		/* file type */
206	uint8_t  ld_major;	/* linker major version */
207	uint8_t  ld_minor;	/* linker minor version */
208	uint32_t text_size;	/* size of text section(s) */
209	uint32_t data_size;	/* size of data section(s) */
210	uint32_t bss_size;	/* size of bss section(s) */
211	uint32_t entry_point;	/* file offset of entry point */
212	uint32_t code_base;	/* relative code addr in ram */
213	uint32_t data_base;	/* relative data addr in ram */
214	/* "windows" header */
215	uint32_t image_base;	/* preferred load address */
216	uint32_t section_align;	/* alignment in bytes */
217	uint32_t file_align;	/* file alignment in bytes */
218	uint16_t os_major;	/* major OS version */
219	uint16_t os_minor;	/* minor OS version */
220	uint16_t image_major;	/* major image version */
221	uint16_t image_minor;	/* minor image version */
222	uint16_t subsys_major;	/* major subsystem version */
223	uint16_t subsys_minor;	/* minor subsystem version */
224	uint32_t win32_version;	/* reserved, must be 0 */
225	uint32_t image_size;	/* image size */
226	uint32_t header_size;	/* header size rounded up to
227				   file_align */
228	uint32_t csum;		/* checksum */
229	uint16_t subsys;	/* subsystem */
230	uint16_t dll_flags;	/* more flags! */
231	uint32_t stack_size_req;/* amt of stack requested */
232	uint32_t stack_size;	/* amt of stack required */
233	uint32_t heap_size_req;	/* amt of heap requested */
234	uint32_t heap_size;	/* amt of heap required */
235	uint32_t loader_flags;	/* reserved, must be 0 */
236	uint32_t data_dirs;	/* number of data dir entries */
237};
238
239struct pe32plus_opt_hdr {
240	uint16_t magic;		/* file type */
241	uint8_t  ld_major;	/* linker major version */
242	uint8_t  ld_minor;	/* linker minor version */
243	uint32_t text_size;	/* size of text section(s) */
244	uint32_t data_size;	/* size of data section(s) */
245	uint32_t bss_size;	/* size of bss section(s) */
246	uint32_t entry_point;	/* file offset of entry point */
247	uint32_t code_base;	/* relative code addr in ram */
248	/* "windows" header */
249	uint64_t image_base;	/* preferred load address */
250	uint32_t section_align;	/* alignment in bytes */
251	uint32_t file_align;	/* file alignment in bytes */
252	uint16_t os_major;	/* major OS version */
253	uint16_t os_minor;	/* minor OS version */
254	uint16_t image_major;	/* major image version */
255	uint16_t image_minor;	/* minor image version */
256	uint16_t subsys_major;	/* major subsystem version */
257	uint16_t subsys_minor;	/* minor subsystem version */
258	uint32_t win32_version;	/* reserved, must be 0 */
259	uint32_t image_size;	/* image size */
260	uint32_t header_size;	/* header size rounded up to
261				   file_align */
262	uint32_t csum;		/* checksum */
263	uint16_t subsys;	/* subsystem */
264	uint16_t dll_flags;	/* more flags! */
265	uint64_t stack_size_req;/* amt of stack requested */
266	uint64_t stack_size;	/* amt of stack required */
267	uint64_t heap_size_req;	/* amt of heap requested */
268	uint64_t heap_size;	/* amt of heap required */
269	uint32_t loader_flags;	/* reserved, must be 0 */
270	uint32_t data_dirs;	/* number of data dir entries */
271};
272
273struct data_dirent {
274	uint32_t virtual_address;	/* relative to load address */
275	uint32_t size;
276};
277
278struct data_directory {
279	struct data_dirent exports;		/* .edata */
280	struct data_dirent imports;		/* .idata */
281	struct data_dirent resources;		/* .rsrc */
282	struct data_dirent exceptions;		/* .pdata */
283	struct data_dirent certs;		/* certs */
284	struct data_dirent base_relocations;	/* .reloc */
285	struct data_dirent debug;		/* .debug */
286	struct data_dirent arch;		/* reservered */
287	struct data_dirent global_ptr;		/* global pointer reg. Size=0 */
288	struct data_dirent tls;			/* .tls */
289	struct data_dirent load_config;		/* load configuration structure */
290	struct data_dirent bound_imports;	/* no idea */
291	struct data_dirent import_addrs;	/* import address table */
292	struct data_dirent delay_imports;	/* delay-load import table */
293	struct data_dirent clr_runtime_hdr;	/* .cor (object only) */
294	struct data_dirent reserved;
295};
296
297struct section_header {
298	char name[8];			/* name or "/12\0" string tbl offset */
299	uint32_t virtual_size;		/* size of loaded section in ram */
300	uint32_t virtual_address;	/* relative virtual address */
301	uint32_t raw_data_size;		/* size of the section */
302	uint32_t data_addr;		/* file pointer to first page of sec */
303	uint32_t relocs;		/* file pointer to relocation entries */
304	uint32_t line_numbers;		/* line numbers! */
305	uint16_t num_relocs;		/* number of relocations */
306	uint16_t num_lin_numbers;	/* srsly. */
307	uint32_t flags;
308};
309
310enum x64_coff_reloc_type {
311	IMAGE_REL_AMD64_ABSOLUTE = 0,
312	IMAGE_REL_AMD64_ADDR64,
313	IMAGE_REL_AMD64_ADDR32,
314	IMAGE_REL_AMD64_ADDR32N,
315	IMAGE_REL_AMD64_REL32,
316	IMAGE_REL_AMD64_REL32_1,
317	IMAGE_REL_AMD64_REL32_2,
318	IMAGE_REL_AMD64_REL32_3,
319	IMAGE_REL_AMD64_REL32_4,
320	IMAGE_REL_AMD64_REL32_5,
321	IMAGE_REL_AMD64_SECTION,
322	IMAGE_REL_AMD64_SECREL,
323	IMAGE_REL_AMD64_SECREL7,
324	IMAGE_REL_AMD64_TOKEN,
325	IMAGE_REL_AMD64_SREL32,
326	IMAGE_REL_AMD64_PAIR,
327	IMAGE_REL_AMD64_SSPAN32,
328};
329
330enum arm_coff_reloc_type {
331	IMAGE_REL_ARM_ABSOLUTE,
332	IMAGE_REL_ARM_ADDR32,
333	IMAGE_REL_ARM_ADDR32N,
334	IMAGE_REL_ARM_BRANCH2,
335	IMAGE_REL_ARM_BRANCH1,
336	IMAGE_REL_ARM_SECTION,
337	IMAGE_REL_ARM_SECREL,
338};
339
340enum sh_coff_reloc_type {
341	IMAGE_REL_SH3_ABSOLUTE,
342	IMAGE_REL_SH3_DIRECT16,
343	IMAGE_REL_SH3_DIRECT32,
344	IMAGE_REL_SH3_DIRECT8,
345	IMAGE_REL_SH3_DIRECT8_WORD,
346	IMAGE_REL_SH3_DIRECT8_LONG,
347	IMAGE_REL_SH3_DIRECT4,
348	IMAGE_REL_SH3_DIRECT4_WORD,
349	IMAGE_REL_SH3_DIRECT4_LONG,
350	IMAGE_REL_SH3_PCREL8_WORD,
351	IMAGE_REL_SH3_PCREL8_LONG,
352	IMAGE_REL_SH3_PCREL12_WORD,
353	IMAGE_REL_SH3_STARTOF_SECTION,
354	IMAGE_REL_SH3_SIZEOF_SECTION,
355	IMAGE_REL_SH3_SECTION,
356	IMAGE_REL_SH3_SECREL,
357	IMAGE_REL_SH3_DIRECT32_NB,
358	IMAGE_REL_SH3_GPREL4_LONG,
359	IMAGE_REL_SH3_TOKEN,
360	IMAGE_REL_SHM_PCRELPT,
361	IMAGE_REL_SHM_REFLO,
362	IMAGE_REL_SHM_REFHALF,
363	IMAGE_REL_SHM_RELLO,
364	IMAGE_REL_SHM_RELHALF,
365	IMAGE_REL_SHM_PAIR,
366	IMAGE_REL_SHM_NOMODE,
367};
368
369enum ppc_coff_reloc_type {
370	IMAGE_REL_PPC_ABSOLUTE,
371	IMAGE_REL_PPC_ADDR64,
372	IMAGE_REL_PPC_ADDR32,
373	IMAGE_REL_PPC_ADDR24,
374	IMAGE_REL_PPC_ADDR16,
375	IMAGE_REL_PPC_ADDR14,
376	IMAGE_REL_PPC_REL24,
377	IMAGE_REL_PPC_REL14,
378	IMAGE_REL_PPC_ADDR32N,
379	IMAGE_REL_PPC_SECREL,
380	IMAGE_REL_PPC_SECTION,
381	IMAGE_REL_PPC_SECREL16,
382	IMAGE_REL_PPC_REFHI,
383	IMAGE_REL_PPC_REFLO,
384	IMAGE_REL_PPC_PAIR,
385	IMAGE_REL_PPC_SECRELLO,
386	IMAGE_REL_PPC_GPREL,
387	IMAGE_REL_PPC_TOKEN,
388};
389
390enum x86_coff_reloc_type {
391	IMAGE_REL_I386_ABSOLUTE,
392	IMAGE_REL_I386_DIR16,
393	IMAGE_REL_I386_REL16,
394	IMAGE_REL_I386_DIR32,
395	IMAGE_REL_I386_DIR32NB,
396	IMAGE_REL_I386_SEG12,
397	IMAGE_REL_I386_SECTION,
398	IMAGE_REL_I386_SECREL,
399	IMAGE_REL_I386_TOKEN,
400	IMAGE_REL_I386_SECREL7,
401	IMAGE_REL_I386_REL32,
402};
403
404enum ia64_coff_reloc_type {
405	IMAGE_REL_IA64_ABSOLUTE,
406	IMAGE_REL_IA64_IMM14,
407	IMAGE_REL_IA64_IMM22,
408	IMAGE_REL_IA64_IMM64,
409	IMAGE_REL_IA64_DIR32,
410	IMAGE_REL_IA64_DIR64,
411	IMAGE_REL_IA64_PCREL21B,
412	IMAGE_REL_IA64_PCREL21M,
413	IMAGE_REL_IA64_PCREL21F,
414	IMAGE_REL_IA64_GPREL22,
415	IMAGE_REL_IA64_LTOFF22,
416	IMAGE_REL_IA64_SECTION,
417	IMAGE_REL_IA64_SECREL22,
418	IMAGE_REL_IA64_SECREL64I,
419	IMAGE_REL_IA64_SECREL32,
420	IMAGE_REL_IA64_DIR32NB,
421	IMAGE_REL_IA64_SREL14,
422	IMAGE_REL_IA64_SREL22,
423	IMAGE_REL_IA64_SREL32,
424	IMAGE_REL_IA64_UREL32,
425	IMAGE_REL_IA64_PCREL60X,
426	IMAGE_REL_IA64_PCREL60B,
427	IMAGE_REL_IA64_PCREL60F,
428	IMAGE_REL_IA64_PCREL60I,
429	IMAGE_REL_IA64_PCREL60M,
430	IMAGE_REL_IA64_IMMGPREL6,
431	IMAGE_REL_IA64_TOKEN,
432	IMAGE_REL_IA64_GPREL32,
433	IMAGE_REL_IA64_ADDEND,
434};
435
436struct coff_reloc {
437	uint32_t virtual_address;
438	uint32_t symbol_table_index;
439	union {
440		enum x64_coff_reloc_type  x64_type;
441		enum arm_coff_reloc_type  arm_type;
442		enum sh_coff_reloc_type   sh_type;
443		enum ppc_coff_reloc_type  ppc_type;
444		enum x86_coff_reloc_type  x86_type;
445		enum ia64_coff_reloc_type ia64_type;
446		uint16_t data;
447	};
448};
449
450/*
451 * Definitions for the contents of the certs data block
452 */
453#define WIN_CERT_TYPE_PKCS_SIGNED_DATA	0x0002
454#define WIN_CERT_TYPE_EFI_OKCS115	0x0EF0
455#define WIN_CERT_TYPE_EFI_GUID		0x0EF1
456
457#define WIN_CERT_REVISION_1_0	0x0100
458#define WIN_CERT_REVISION_2_0	0x0200
459
460struct win_certificate {
461	uint32_t length;
462	uint16_t revision;
463	uint16_t cert_type;
464};
465
466#endif /* !__ASSEMBLY__ */
467
468#endif /* __LINUX_PE_H */
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-only */
  2/*
  3 * Copyright 2011 Red Hat, Inc.
  4 * All rights reserved.
  5 *
  6 * Author(s): Peter Jones <pjones@redhat.com>
  7 */
  8#ifndef __LINUX_PE_H
  9#define __LINUX_PE_H
 10
 11#include <linux/types.h>
 12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 13#define MZ_MAGIC	0x5a4d	/* "MZ" */
 14
 15#define PE_MAGIC		0x00004550	/* "PE\0\0" */
 16#define PE_OPT_MAGIC_PE32	0x010b
 17#define PE_OPT_MAGIC_PE32_ROM	0x0107
 18#define PE_OPT_MAGIC_PE32PLUS	0x020b
 19
 20/* machine type */
 21#define	IMAGE_FILE_MACHINE_UNKNOWN	0x0000
 22#define	IMAGE_FILE_MACHINE_AM33		0x01d3
 23#define	IMAGE_FILE_MACHINE_AMD64	0x8664
 24#define	IMAGE_FILE_MACHINE_ARM		0x01c0
 25#define	IMAGE_FILE_MACHINE_ARMV7	0x01c4
 26#define	IMAGE_FILE_MACHINE_ARM64	0xaa64
 27#define	IMAGE_FILE_MACHINE_EBC		0x0ebc
 28#define	IMAGE_FILE_MACHINE_I386		0x014c
 29#define	IMAGE_FILE_MACHINE_IA64		0x0200
 30#define	IMAGE_FILE_MACHINE_M32R		0x9041
 31#define	IMAGE_FILE_MACHINE_MIPS16	0x0266
 32#define	IMAGE_FILE_MACHINE_MIPSFPU	0x0366
 33#define	IMAGE_FILE_MACHINE_MIPSFPU16	0x0466
 34#define	IMAGE_FILE_MACHINE_POWERPC	0x01f0
 35#define	IMAGE_FILE_MACHINE_POWERPCFP	0x01f1
 36#define	IMAGE_FILE_MACHINE_R4000	0x0166
 
 
 
 37#define	IMAGE_FILE_MACHINE_SH3		0x01a2
 38#define	IMAGE_FILE_MACHINE_SH3DSP	0x01a3
 39#define	IMAGE_FILE_MACHINE_SH3E		0x01a4
 40#define	IMAGE_FILE_MACHINE_SH4		0x01a6
 41#define	IMAGE_FILE_MACHINE_SH5		0x01a8
 42#define	IMAGE_FILE_MACHINE_THUMB	0x01c2
 43#define	IMAGE_FILE_MACHINE_WCEMIPSV2	0x0169
 44
 45/* flags */
 46#define IMAGE_FILE_RELOCS_STRIPPED           0x0001
 47#define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002
 48#define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004
 49#define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008
 50#define IMAGE_FILE_AGGRESSIVE_WS_TRIM        0x0010
 51#define IMAGE_FILE_LARGE_ADDRESS_AWARE       0x0020
 52#define IMAGE_FILE_16BIT_MACHINE             0x0040
 53#define IMAGE_FILE_BYTES_REVERSED_LO         0x0080
 54#define IMAGE_FILE_32BIT_MACHINE             0x0100
 55#define IMAGE_FILE_DEBUG_STRIPPED            0x0200
 56#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP   0x0400
 57#define IMAGE_FILE_NET_RUN_FROM_SWAP         0x0800
 58#define IMAGE_FILE_SYSTEM                    0x1000
 59#define IMAGE_FILE_DLL                       0x2000
 60#define IMAGE_FILE_UP_SYSTEM_ONLY            0x4000
 61#define IMAGE_FILE_BYTES_REVERSED_HI         0x8000
 62
 63#define IMAGE_FILE_OPT_ROM_MAGIC	0x107
 64#define IMAGE_FILE_OPT_PE32_MAGIC	0x10b
 65#define IMAGE_FILE_OPT_PE32_PLUS_MAGIC	0x20b
 66
 67#define IMAGE_SUBSYSTEM_UNKNOWN			 0
 68#define IMAGE_SUBSYSTEM_NATIVE			 1
 69#define IMAGE_SUBSYSTEM_WINDOWS_GUI		 2
 70#define IMAGE_SUBSYSTEM_WINDOWS_CUI		 3
 71#define IMAGE_SUBSYSTEM_POSIX_CUI		 7
 72#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI		 9
 73#define IMAGE_SUBSYSTEM_EFI_APPLICATION		10
 74#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER	11
 75#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER	12
 76#define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE		13
 77#define IMAGE_SUBSYSTEM_XBOX			14
 78
 79#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE          0x0040
 80#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY       0x0080
 81#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT             0x0100
 82#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION           0x0200
 83#define IMAGE_DLLCHARACTERISTICS_NO_SEH                 0x0400
 84#define IMAGE_DLLCHARACTERISTICS_NO_BIND                0x0800
 85#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER             0x2000
 86#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE  0x8000
 87
 88/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
 89#define IMAGE_SCN_RESERVED_0	0x00000001
 90#define IMAGE_SCN_RESERVED_1	0x00000002
 91#define IMAGE_SCN_RESERVED_2	0x00000004
 92#define IMAGE_SCN_TYPE_NO_PAD	0x00000008 /* don't pad - obsolete */
 93#define IMAGE_SCN_RESERVED_3	0x00000010
 94#define IMAGE_SCN_CNT_CODE	0x00000020 /* .text */
 95#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* .data */
 96#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
 97#define IMAGE_SCN_LNK_OTHER	0x00000100 /* reserved */
 98#define IMAGE_SCN_LNK_INFO	0x00000200 /* .drectve comments */
 99#define IMAGE_SCN_RESERVED_4	0x00000400
100#define IMAGE_SCN_LNK_REMOVE	0x00000800 /* .o only - scn to be rm'd*/
101#define IMAGE_SCN_LNK_COMDAT	0x00001000 /* .o only - COMDAT data */
102#define IMAGE_SCN_RESERVED_5	0x00002000 /* spec omits this */
103#define IMAGE_SCN_RESERVED_6	0x00004000 /* spec omits this */
104#define IMAGE_SCN_GPREL		0x00008000 /* global pointer referenced data */
105/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
106#define IMAGE_SCN_MEM_PURGEABLE	0x00010000 /* reserved for "future" use */
107#define IMAGE_SCN_16BIT		0x00020000 /* reserved for "future" use */
108#define IMAGE_SCN_LOCKED	0x00040000 /* reserved for "future" use */
109#define IMAGE_SCN_PRELOAD	0x00080000 /* reserved for "future" use */
110/* and here they just stuck a 1-byte integer in the middle of a bitfield */
111#define IMAGE_SCN_ALIGN_1BYTES	0x00100000 /* it does what it says on the box */
112#define IMAGE_SCN_ALIGN_2BYTES	0x00200000
113#define IMAGE_SCN_ALIGN_4BYTES	0x00300000
114#define IMAGE_SCN_ALIGN_8BYTES	0x00400000
115#define IMAGE_SCN_ALIGN_16BYTES	0x00500000
116#define IMAGE_SCN_ALIGN_32BYTES	0x00600000
117#define IMAGE_SCN_ALIGN_64BYTES	0x00700000
118#define IMAGE_SCN_ALIGN_128BYTES 0x00800000
119#define IMAGE_SCN_ALIGN_256BYTES 0x00900000
120#define IMAGE_SCN_ALIGN_512BYTES 0x00a00000
121#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
122#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
123#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
124#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
125#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
126#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
127#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* cannot be cached */
128#define IMAGE_SCN_MEM_NOT_PAGED	0x08000000 /* not pageable */
129#define IMAGE_SCN_MEM_SHARED	0x10000000 /* can be shared */
130#define IMAGE_SCN_MEM_EXECUTE	0x20000000 /* can be executed as code */
131#define IMAGE_SCN_MEM_READ	0x40000000 /* readable */
132#define IMAGE_SCN_MEM_WRITE	0x80000000 /* writeable */
133
134#define IMAGE_DEBUG_TYPE_CODEVIEW	2
135
136#ifndef __ASSEMBLY__
137
138struct mz_hdr {
139	uint16_t magic;		/* MZ_MAGIC */
140	uint16_t lbsize;	/* size of last used block */
141	uint16_t blocks;	/* pages in file, 0x3 */
142	uint16_t relocs;	/* relocations */
143	uint16_t hdrsize;	/* header size in "paragraphs" */
144	uint16_t min_extra_pps;	/* .bss */
145	uint16_t max_extra_pps;	/* runtime limit for the arena size */
146	uint16_t ss;		/* relative stack segment */
147	uint16_t sp;		/* initial %sp register */
148	uint16_t checksum;	/* word checksum */
149	uint16_t ip;		/* initial %ip register */
150	uint16_t cs;		/* initial %cs relative to load segment */
151	uint16_t reloc_table_offset;	/* offset of the first relocation */
152	uint16_t overlay_num;	/* overlay number.  set to 0. */
153	uint16_t reserved0[4];	/* reserved */
154	uint16_t oem_id;	/* oem identifier */
155	uint16_t oem_info;	/* oem specific */
156	uint16_t reserved1[10];	/* reserved */
157	uint32_t peaddr;	/* address of pe header */
158	char     message[];	/* message to print */
159};
160
161struct mz_reloc {
162	uint16_t offset;
163	uint16_t segment;
164};
165
166struct pe_hdr {
167	uint32_t magic;		/* PE magic */
168	uint16_t machine;	/* machine type */
169	uint16_t sections;	/* number of sections */
170	uint32_t timestamp;	/* time_t */
171	uint32_t symbol_table;	/* symbol table offset */
172	uint32_t symbols;	/* number of symbols */
173	uint16_t opt_hdr_size;	/* size of optional header */
174	uint16_t flags;		/* flags */
175};
176
177/* the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
178 * work right.  vomit. */
179struct pe32_opt_hdr {
180	/* "standard" header */
181	uint16_t magic;		/* file type */
182	uint8_t  ld_major;	/* linker major version */
183	uint8_t  ld_minor;	/* linker minor version */
184	uint32_t text_size;	/* size of text section(s) */
185	uint32_t data_size;	/* size of data section(s) */
186	uint32_t bss_size;	/* size of bss section(s) */
187	uint32_t entry_point;	/* file offset of entry point */
188	uint32_t code_base;	/* relative code addr in ram */
189	uint32_t data_base;	/* relative data addr in ram */
190	/* "windows" header */
191	uint32_t image_base;	/* preferred load address */
192	uint32_t section_align;	/* alignment in bytes */
193	uint32_t file_align;	/* file alignment in bytes */
194	uint16_t os_major;	/* major OS version */
195	uint16_t os_minor;	/* minor OS version */
196	uint16_t image_major;	/* major image version */
197	uint16_t image_minor;	/* minor image version */
198	uint16_t subsys_major;	/* major subsystem version */
199	uint16_t subsys_minor;	/* minor subsystem version */
200	uint32_t win32_version;	/* reserved, must be 0 */
201	uint32_t image_size;	/* image size */
202	uint32_t header_size;	/* header size rounded up to
203				   file_align */
204	uint32_t csum;		/* checksum */
205	uint16_t subsys;	/* subsystem */
206	uint16_t dll_flags;	/* more flags! */
207	uint32_t stack_size_req;/* amt of stack requested */
208	uint32_t stack_size;	/* amt of stack required */
209	uint32_t heap_size_req;	/* amt of heap requested */
210	uint32_t heap_size;	/* amt of heap required */
211	uint32_t loader_flags;	/* reserved, must be 0 */
212	uint32_t data_dirs;	/* number of data dir entries */
213};
214
215struct pe32plus_opt_hdr {
216	uint16_t magic;		/* file type */
217	uint8_t  ld_major;	/* linker major version */
218	uint8_t  ld_minor;	/* linker minor version */
219	uint32_t text_size;	/* size of text section(s) */
220	uint32_t data_size;	/* size of data section(s) */
221	uint32_t bss_size;	/* size of bss section(s) */
222	uint32_t entry_point;	/* file offset of entry point */
223	uint32_t code_base;	/* relative code addr in ram */
224	/* "windows" header */
225	uint64_t image_base;	/* preferred load address */
226	uint32_t section_align;	/* alignment in bytes */
227	uint32_t file_align;	/* file alignment in bytes */
228	uint16_t os_major;	/* major OS version */
229	uint16_t os_minor;	/* minor OS version */
230	uint16_t image_major;	/* major image version */
231	uint16_t image_minor;	/* minor image version */
232	uint16_t subsys_major;	/* major subsystem version */
233	uint16_t subsys_minor;	/* minor subsystem version */
234	uint32_t win32_version;	/* reserved, must be 0 */
235	uint32_t image_size;	/* image size */
236	uint32_t header_size;	/* header size rounded up to
237				   file_align */
238	uint32_t csum;		/* checksum */
239	uint16_t subsys;	/* subsystem */
240	uint16_t dll_flags;	/* more flags! */
241	uint64_t stack_size_req;/* amt of stack requested */
242	uint64_t stack_size;	/* amt of stack required */
243	uint64_t heap_size_req;	/* amt of heap requested */
244	uint64_t heap_size;	/* amt of heap required */
245	uint32_t loader_flags;	/* reserved, must be 0 */
246	uint32_t data_dirs;	/* number of data dir entries */
247};
248
249struct data_dirent {
250	uint32_t virtual_address;	/* relative to load address */
251	uint32_t size;
252};
253
254struct data_directory {
255	struct data_dirent exports;		/* .edata */
256	struct data_dirent imports;		/* .idata */
257	struct data_dirent resources;		/* .rsrc */
258	struct data_dirent exceptions;		/* .pdata */
259	struct data_dirent certs;		/* certs */
260	struct data_dirent base_relocations;	/* .reloc */
261	struct data_dirent debug;		/* .debug */
262	struct data_dirent arch;		/* reservered */
263	struct data_dirent global_ptr;		/* global pointer reg. Size=0 */
264	struct data_dirent tls;			/* .tls */
265	struct data_dirent load_config;		/* load configuration structure */
266	struct data_dirent bound_imports;	/* no idea */
267	struct data_dirent import_addrs;	/* import address table */
268	struct data_dirent delay_imports;	/* delay-load import table */
269	struct data_dirent clr_runtime_hdr;	/* .cor (object only) */
270	struct data_dirent reserved;
271};
272
273struct section_header {
274	char name[8];			/* name or "/12\0" string tbl offset */
275	uint32_t virtual_size;		/* size of loaded section in ram */
276	uint32_t virtual_address;	/* relative virtual address */
277	uint32_t raw_data_size;		/* size of the section */
278	uint32_t data_addr;		/* file pointer to first page of sec */
279	uint32_t relocs;		/* file pointer to relocation entries */
280	uint32_t line_numbers;		/* line numbers! */
281	uint16_t num_relocs;		/* number of relocations */
282	uint16_t num_lin_numbers;	/* srsly. */
283	uint32_t flags;
284};
285
286enum x64_coff_reloc_type {
287	IMAGE_REL_AMD64_ABSOLUTE = 0,
288	IMAGE_REL_AMD64_ADDR64,
289	IMAGE_REL_AMD64_ADDR32,
290	IMAGE_REL_AMD64_ADDR32N,
291	IMAGE_REL_AMD64_REL32,
292	IMAGE_REL_AMD64_REL32_1,
293	IMAGE_REL_AMD64_REL32_2,
294	IMAGE_REL_AMD64_REL32_3,
295	IMAGE_REL_AMD64_REL32_4,
296	IMAGE_REL_AMD64_REL32_5,
297	IMAGE_REL_AMD64_SECTION,
298	IMAGE_REL_AMD64_SECREL,
299	IMAGE_REL_AMD64_SECREL7,
300	IMAGE_REL_AMD64_TOKEN,
301	IMAGE_REL_AMD64_SREL32,
302	IMAGE_REL_AMD64_PAIR,
303	IMAGE_REL_AMD64_SSPAN32,
304};
305
306enum arm_coff_reloc_type {
307	IMAGE_REL_ARM_ABSOLUTE,
308	IMAGE_REL_ARM_ADDR32,
309	IMAGE_REL_ARM_ADDR32N,
310	IMAGE_REL_ARM_BRANCH2,
311	IMAGE_REL_ARM_BRANCH1,
312	IMAGE_REL_ARM_SECTION,
313	IMAGE_REL_ARM_SECREL,
314};
315
316enum sh_coff_reloc_type {
317	IMAGE_REL_SH3_ABSOLUTE,
318	IMAGE_REL_SH3_DIRECT16,
319	IMAGE_REL_SH3_DIRECT32,
320	IMAGE_REL_SH3_DIRECT8,
321	IMAGE_REL_SH3_DIRECT8_WORD,
322	IMAGE_REL_SH3_DIRECT8_LONG,
323	IMAGE_REL_SH3_DIRECT4,
324	IMAGE_REL_SH3_DIRECT4_WORD,
325	IMAGE_REL_SH3_DIRECT4_LONG,
326	IMAGE_REL_SH3_PCREL8_WORD,
327	IMAGE_REL_SH3_PCREL8_LONG,
328	IMAGE_REL_SH3_PCREL12_WORD,
329	IMAGE_REL_SH3_STARTOF_SECTION,
330	IMAGE_REL_SH3_SIZEOF_SECTION,
331	IMAGE_REL_SH3_SECTION,
332	IMAGE_REL_SH3_SECREL,
333	IMAGE_REL_SH3_DIRECT32_NB,
334	IMAGE_REL_SH3_GPREL4_LONG,
335	IMAGE_REL_SH3_TOKEN,
336	IMAGE_REL_SHM_PCRELPT,
337	IMAGE_REL_SHM_REFLO,
338	IMAGE_REL_SHM_REFHALF,
339	IMAGE_REL_SHM_RELLO,
340	IMAGE_REL_SHM_RELHALF,
341	IMAGE_REL_SHM_PAIR,
342	IMAGE_REL_SHM_NOMODE,
343};
344
345enum ppc_coff_reloc_type {
346	IMAGE_REL_PPC_ABSOLUTE,
347	IMAGE_REL_PPC_ADDR64,
348	IMAGE_REL_PPC_ADDR32,
349	IMAGE_REL_PPC_ADDR24,
350	IMAGE_REL_PPC_ADDR16,
351	IMAGE_REL_PPC_ADDR14,
352	IMAGE_REL_PPC_REL24,
353	IMAGE_REL_PPC_REL14,
354	IMAGE_REL_PPC_ADDR32N,
355	IMAGE_REL_PPC_SECREL,
356	IMAGE_REL_PPC_SECTION,
357	IMAGE_REL_PPC_SECREL16,
358	IMAGE_REL_PPC_REFHI,
359	IMAGE_REL_PPC_REFLO,
360	IMAGE_REL_PPC_PAIR,
361	IMAGE_REL_PPC_SECRELLO,
362	IMAGE_REL_PPC_GPREL,
363	IMAGE_REL_PPC_TOKEN,
364};
365
366enum x86_coff_reloc_type {
367	IMAGE_REL_I386_ABSOLUTE,
368	IMAGE_REL_I386_DIR16,
369	IMAGE_REL_I386_REL16,
370	IMAGE_REL_I386_DIR32,
371	IMAGE_REL_I386_DIR32NB,
372	IMAGE_REL_I386_SEG12,
373	IMAGE_REL_I386_SECTION,
374	IMAGE_REL_I386_SECREL,
375	IMAGE_REL_I386_TOKEN,
376	IMAGE_REL_I386_SECREL7,
377	IMAGE_REL_I386_REL32,
378};
379
380enum ia64_coff_reloc_type {
381	IMAGE_REL_IA64_ABSOLUTE,
382	IMAGE_REL_IA64_IMM14,
383	IMAGE_REL_IA64_IMM22,
384	IMAGE_REL_IA64_IMM64,
385	IMAGE_REL_IA64_DIR32,
386	IMAGE_REL_IA64_DIR64,
387	IMAGE_REL_IA64_PCREL21B,
388	IMAGE_REL_IA64_PCREL21M,
389	IMAGE_REL_IA64_PCREL21F,
390	IMAGE_REL_IA64_GPREL22,
391	IMAGE_REL_IA64_LTOFF22,
392	IMAGE_REL_IA64_SECTION,
393	IMAGE_REL_IA64_SECREL22,
394	IMAGE_REL_IA64_SECREL64I,
395	IMAGE_REL_IA64_SECREL32,
396	IMAGE_REL_IA64_DIR32NB,
397	IMAGE_REL_IA64_SREL14,
398	IMAGE_REL_IA64_SREL22,
399	IMAGE_REL_IA64_SREL32,
400	IMAGE_REL_IA64_UREL32,
401	IMAGE_REL_IA64_PCREL60X,
402	IMAGE_REL_IA64_PCREL60B,
403	IMAGE_REL_IA64_PCREL60F,
404	IMAGE_REL_IA64_PCREL60I,
405	IMAGE_REL_IA64_PCREL60M,
406	IMAGE_REL_IA64_IMMGPREL6,
407	IMAGE_REL_IA64_TOKEN,
408	IMAGE_REL_IA64_GPREL32,
409	IMAGE_REL_IA64_ADDEND,
410};
411
412struct coff_reloc {
413	uint32_t virtual_address;
414	uint32_t symbol_table_index;
415	union {
416		enum x64_coff_reloc_type  x64_type;
417		enum arm_coff_reloc_type  arm_type;
418		enum sh_coff_reloc_type   sh_type;
419		enum ppc_coff_reloc_type  ppc_type;
420		enum x86_coff_reloc_type  x86_type;
421		enum ia64_coff_reloc_type ia64_type;
422		uint16_t data;
423	};
424};
425
426/*
427 * Definitions for the contents of the certs data block
428 */
429#define WIN_CERT_TYPE_PKCS_SIGNED_DATA	0x0002
430#define WIN_CERT_TYPE_EFI_OKCS115	0x0EF0
431#define WIN_CERT_TYPE_EFI_GUID		0x0EF1
432
433#define WIN_CERT_REVISION_1_0	0x0100
434#define WIN_CERT_REVISION_2_0	0x0200
435
436struct win_certificate {
437	uint32_t length;
438	uint16_t revision;
439	uint16_t cert_type;
440};
441
442#endif /* !__ASSEMBLY__ */
443
444#endif /* __LINUX_PE_H */