blob: cd5b6ad62bf0f9de8c660161c9248e4a4b53ed15 [file] [log] [blame]
Tom Rini70df9d62018-05-07 17:02:21 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heinrich Schuchardt467fd7a2018-01-31 18:45:35 +00002/*
3 * Portable Executable and Common Object Constants
4 *
5 * Copyright (c) 2018 Heinrich Schuchardt
6 *
7 * based on the "Microsoft Portable Executable and Common Object File Format
8 * Specification", revision 11, 2017-01-23
Heinrich Schuchardt467fd7a2018-01-31 18:45:35 +00009 */
10
11#ifndef _ASM_PE_H
12#define _ASM_PE_H
13
Bin Mengca281e82018-10-02 07:39:32 -070014/* Characteristics */
15#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
16#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
17#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
18#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
19#define IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010
20#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
21/* Reserved 0x0040 */
22#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
23#define IMAGE_FILE_32BIT_MACHINE 0x0100
24#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
25#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
26#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
27#define IMAGE_FILE_SYSTEM 0x1000
28#define IMAGE_FILE_DLL 0x2000
29#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
30#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
31
Heinrich Schuchardtd680e9a2019-07-11 06:39:32 +020032/* Machine types */
33#define IMAGE_FILE_MACHINE_I386 0x014c
34#define IMAGE_FILE_MACHINE_ARM 0x01c0
35#define IMAGE_FILE_MACHINE_THUMB 0x01c2
36#define IMAGE_FILE_MACHINE_ARMNT 0x01c4
37#define IMAGE_FILE_MACHINE_AMD64 0x8664
38#define IMAGE_FILE_MACHINE_ARM64 0xaa64
39#define IMAGE_FILE_MACHINE_RISCV32 0x5032
40#define IMAGE_FILE_MACHINE_RISCV64 0x5064
41
42/* Header magic constants */
43#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x010b
44#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x020b
45#define IMAGE_DOS_SIGNATURE 0x5a4d /* MZ */
46#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
47
Heinrich Schuchardt467fd7a2018-01-31 18:45:35 +000048/* Subsystem type */
49#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
50#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
51#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
52#define IMAGE_SUBSYSTEM_EFI_ROM 13
53
Heinrich Schuchardt299425d2024-02-14 21:43:21 +010054/* DLL characteristics */
55#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x100
56
Heinrich Schuchardt04296bf2023-01-04 12:18:54 +010057/* Section flags */
58#define IMAGE_SCN_CNT_CODE 0x00000020
59#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
60#define IMAGE_SCN_CNT_UNINITIALIZED_ DATA 0x00000080
61#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
62#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
63#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
64#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
65#define IMAGE_SCN_MEM_SHARED 0x10000000
66#define IMAGE_SCN_MEM_EXECUTE 0x20000000
67#define IMAGE_SCN_MEM_READ 0x40000000
68#define IMAGE_SCN_MEM_WRITE 0x80000000
69
Heinrich Schuchardtd6bc9ec2021-01-29 12:35:51 +010070#define LINUX_ARM64_MAGIC 0x644d5241
71
Heinrich Schuchardt467fd7a2018-01-31 18:45:35 +000072#endif /* _ASM_PE_H */