LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
ProcessorFlags.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_ELF_PROCESSOR_FLAGS_H
17#define LIEF_ELF_PROCESSOR_FLAGS_H
18#include <cstdint>
19#include "LIEF/visibility.h"
20
21namespace LIEF {
22namespace ELF {
23
24static constexpr uint64_t PFLAGS_BIT = 43;
25static constexpr uint64_t PFLAGS_MASK = (1LLU << PFLAGS_BIT) - 1;
26static constexpr uint64_t PF_ARM_ID = 1;
27static constexpr uint64_t PF_HEX_ID = 2;
28static constexpr uint64_t PF_LOONGARCH_ID = 3;
29static constexpr uint64_t PF_MIPS_ID = 4;
30static constexpr uint64_t PF_RISCV_ID = 5;
31
32enum class PROCESSOR_FLAGS : uint64_t {
33 ARM_EABI_UNKNOWN = 0x00000000 | (PF_ARM_ID << PFLAGS_BIT),
34 ARM_SOFT_FLOAT = 0x00000200 | (PF_ARM_ID << PFLAGS_BIT),
35 ARM_VFP_FLOAT = 0x00000400 | (PF_ARM_ID << PFLAGS_BIT),
36 ARM_EABI_VER1 = 0x01000000 | (PF_ARM_ID << PFLAGS_BIT),
37 ARM_EABI_VER2 = 0x02000000 | (PF_ARM_ID << PFLAGS_BIT),
38 ARM_EABI_VER3 = 0x03000000 | (PF_ARM_ID << PFLAGS_BIT),
39 ARM_EABI_VER4 = 0x04000000 | (PF_ARM_ID << PFLAGS_BIT),
40 ARM_EABI_VER5 = 0x05000000 | (PF_ARM_ID << PFLAGS_BIT),
41
42 HEXAGON_MACH_V2 = 0x00000001 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V2
43 HEXAGON_MACH_V3 = 0x00000002 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V3
44 HEXAGON_MACH_V4 = 0x00000003 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V4
45 HEXAGON_MACH_V5 = 0x00000004 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V5
46
47 HEXAGON_ISA_V2 = 0x00000010 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V2 ISA
48 HEXAGON_ISA_V3 = 0x00000020 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V3 ISA
49 HEXAGON_ISA_V4 = 0x00000030 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V4 ISA
50 HEXAGON_ISA_V5 = 0x00000040 | (PF_HEX_ID << PFLAGS_BIT), // Hexagon V5 ISA
51
52 LOONGARCH_ABI_SOFT_FLOAT = 0x1 | (PF_LOONGARCH_ID << PFLAGS_BIT),
53 LOONGARCH_ABI_SINGLE_FLOAT = 0x2 | (PF_LOONGARCH_ID << PFLAGS_BIT),
54 LOONGARCH_ABI_DOUBLE_FLOAT = 0x3 | (PF_LOONGARCH_ID << PFLAGS_BIT),
55
56 MIPS_NOREORDER = 0x00000001 | (PF_MIPS_ID << PFLAGS_BIT), /* Don't reorder instructions */
57 MIPS_PIC = 0x00000002 | (PF_MIPS_ID << PFLAGS_BIT), /* Position independent code */
58 MIPS_CPIC = 0x00000004 | (PF_MIPS_ID << PFLAGS_BIT), /* Call object with Position independent code */
59 MIPS_ABI2 = 0x00000020 | (PF_MIPS_ID << PFLAGS_BIT), /* File uses N32 ABI */
60 MIPS_32BITMODE = 0x00000100 | (PF_MIPS_ID << PFLAGS_BIT), /* Code compiled for a 64-bit machine */
61 /* in 32-bit mode */
62 MIPS_FP64 = 0x00000200 | (PF_MIPS_ID << PFLAGS_BIT), /* Code compiled for a 32-bit machine */
63 /* but uses 64-bit FP registers */
64 MIPS_NAN2008 = 0x00000400 | (PF_MIPS_ID << PFLAGS_BIT), /* Uses IEE 754-2008 NaN encoding */
65
66 /* ABI flags */
67 MIPS_ABI_O32 = 0x00001000 | (PF_MIPS_ID << PFLAGS_BIT), /* This file follows the first MIPS 32 bit ABI */
68 MIPS_ABI_O64 = 0x00002000 | (PF_MIPS_ID << PFLAGS_BIT), /* O32 ABI extended for 64-bit architecture. */
69 MIPS_ABI_EABI32 = 0x00003000 | (PF_MIPS_ID << PFLAGS_BIT), /* EABI in 32 bit mode. */
70 MIPS_ABI_EABI64 = 0x00004000 | (PF_MIPS_ID << PFLAGS_BIT), /* EABI in 64 bit mode. */
71
72 /* MIPS machine variant */
73 MIPS_MACH_3900 = 0x00810000 | (PF_MIPS_ID << PFLAGS_BIT), /* Toshiba R3900 */
74 MIPS_MACH_4010 = 0x00820000 | (PF_MIPS_ID << PFLAGS_BIT), /* LSI R4010 */
75 MIPS_MACH_4100 = 0x00830000 | (PF_MIPS_ID << PFLAGS_BIT), /* NEC VR4100 */
76 MIPS_MACH_4650 = 0x00850000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS R4650 */
77 MIPS_MACH_4120 = 0x00870000 | (PF_MIPS_ID << PFLAGS_BIT), /* NEC VR4120 */
78 MIPS_MACH_4111 = 0x00880000 | (PF_MIPS_ID << PFLAGS_BIT), /* NEC VR4111/VR4181 */
79 MIPS_MACH_SB1 = 0x008a0000 | (PF_MIPS_ID << PFLAGS_BIT), /* Broadcom SB-1 */
80 MIPS_MACH_OCTEON = 0x008b0000 | (PF_MIPS_ID << PFLAGS_BIT), /* Cavium Networks Octeon */
81 MIPS_MACH_XLR = 0x008c0000 | (PF_MIPS_ID << PFLAGS_BIT), /* RMI Xlr */
82 MIPS_MACH_OCTEON2 = 0x008d0000 | (PF_MIPS_ID << PFLAGS_BIT), /* Cavium Networks Octeon2 */
83 MIPS_MACH_OCTEON3 = 0x008e0000 | (PF_MIPS_ID << PFLAGS_BIT), /* Cavium Networks Octeon3 */
84 MIPS_MACH_5400 = 0x00910000 | (PF_MIPS_ID << PFLAGS_BIT), /* NEC VR5400 */
85 MIPS_MACH_5900 = 0x00920000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS R5900 */
86 MIPS_MACH_5500 = 0x00980000 | (PF_MIPS_ID << PFLAGS_BIT), /* NEC VR5500 */
87 MIPS_MACH_9000 = 0x00990000 | (PF_MIPS_ID << PFLAGS_BIT), /* Unknown */
88 MIPS_MACH_LS2E = 0x00a00000 | (PF_MIPS_ID << PFLAGS_BIT), /* ST Microelectronics Loongson 2E */
89 MIPS_MACH_LS2F = 0x00a10000 | (PF_MIPS_ID << PFLAGS_BIT), /* ST Microelectronics Loongson 2F */
90 MIPS_MACH_LS3A = 0x00a20000 | (PF_MIPS_ID << PFLAGS_BIT), /* Loongson 3A */
91
92 /* ARCH_ASE */
93 MIPS_MICROMIPS = 0x02000000 | (PF_MIPS_ID << PFLAGS_BIT), /* microMIPS */
94 MIPS_ARCH_ASE_M16 = 0x04000000 | (PF_MIPS_ID << PFLAGS_BIT), /* Has Mips-16 ISA extensions */
95 MIPS_ARCH_ASE_MDMX = 0x08000000 | (PF_MIPS_ID << PFLAGS_BIT), /* Has MDMX multimedia extensions */
96
97 /* ARCH */
98 MIPS_ARCH_1 = 0x00000000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS1 instruction set */
99 MIPS_ARCH_2 = 0x10000000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS2 instruction set */
100 MIPS_ARCH_3 = 0x20000000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS3 instruction set */
101 MIPS_ARCH_4 = 0x30000000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS4 instruction set */
102 MIPS_ARCH_5 = 0x40000000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS5 instruction set */
103 MIPS_ARCH_32 = 0x50000000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS32 instruction set per linux not elf.h */
104 MIPS_ARCH_64 = 0x60000000 | (PF_MIPS_ID << PFLAGS_BIT), /* MIPS64 instruction set per linux not elf.h */
105 MIPS_ARCH_32R2 = 0x70000000 | (PF_MIPS_ID << PFLAGS_BIT), /* mips32r2, mips32r3, mips32r5 */
106 MIPS_ARCH_64R2 = 0x80000000 | (PF_MIPS_ID << PFLAGS_BIT), /* mips64r2, mips64r3, mips64r5 */
107 MIPS_ARCH_32R6 = 0x90000000 | (PF_MIPS_ID << PFLAGS_BIT), /* mips32r6 */
108 MIPS_ARCH_64R6 = 0xa0000000 | (PF_MIPS_ID << PFLAGS_BIT), /* mips64r6 */
109
110 RISCV_RVC = 0x00000001 | (PF_RISCV_ID << PFLAGS_BIT),
111
112 RISCV_FLOAT_ABI_SOFT = 0x00000000 | (PF_RISCV_ID << PFLAGS_BIT),
113 RISCV_FLOAT_ABI_SINGLE = 0x00000002 | (PF_RISCV_ID << PFLAGS_BIT),
114 RISCV_FLOAT_ABI_DOUBLE = 0x00000004 | (PF_RISCV_ID << PFLAGS_BIT),
115 RISCV_FLOAT_ABI_QUAD = 0x00000006 | (PF_RISCV_ID << PFLAGS_BIT),
116
117 RISCV_FLOAT_ABI_RVE = 0x00000008 | (PF_RISCV_ID << PFLAGS_BIT),
118 RISCV_FLOAT_ABI_TSO = 0x00000010 | (PF_RISCV_ID << PFLAGS_BIT),
119};
120
122
123
124}
125}
126#endif
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:28
const char * to_string(DynamicEntry::TAG e)
PROCESSOR_FLAGS
Definition ProcessorFlags.hpp:32
@ MIPS_MICROMIPS
Definition ProcessorFlags.hpp:93
@ MIPS_PIC
Definition ProcessorFlags.hpp:57
@ MIPS_MACH_4120
Definition ProcessorFlags.hpp:77
@ MIPS_FP64
Definition ProcessorFlags.hpp:62
@ MIPS_ARCH_3
Definition ProcessorFlags.hpp:100
@ MIPS_32BITMODE
Definition ProcessorFlags.hpp:60
@ MIPS_MACH_3900
Definition ProcessorFlags.hpp:73
@ RISCV_FLOAT_ABI_RVE
Definition ProcessorFlags.hpp:117
@ ARM_EABI_VER3
Definition ProcessorFlags.hpp:38
@ LOONGARCH_ABI_SINGLE_FLOAT
Definition ProcessorFlags.hpp:53
@ MIPS_MACH_LS2F
Definition ProcessorFlags.hpp:89
@ HEXAGON_ISA_V3
Definition ProcessorFlags.hpp:48
@ MIPS_MACH_4650
Definition ProcessorFlags.hpp:76
@ RISCV_FLOAT_ABI_SOFT
Definition ProcessorFlags.hpp:112
@ MIPS_NOREORDER
Definition ProcessorFlags.hpp:56
@ MIPS_ARCH_2
Definition ProcessorFlags.hpp:99
@ MIPS_MACH_5400
Definition ProcessorFlags.hpp:84
@ MIPS_MACH_OCTEON3
Definition ProcessorFlags.hpp:83
@ ARM_EABI_VER1
Definition ProcessorFlags.hpp:36
@ HEXAGON_ISA_V2
Definition ProcessorFlags.hpp:47
@ MIPS_MACH_4111
Definition ProcessorFlags.hpp:78
@ ARM_EABI_VER5
Definition ProcessorFlags.hpp:40
@ HEXAGON_MACH_V2
Definition ProcessorFlags.hpp:42
@ RISCV_FLOAT_ABI_QUAD
Definition ProcessorFlags.hpp:115
@ HEXAGON_ISA_V4
Definition ProcessorFlags.hpp:49
@ MIPS_ARCH_4
Definition ProcessorFlags.hpp:101
@ MIPS_MACH_OCTEON
Definition ProcessorFlags.hpp:80
@ MIPS_ABI_EABI32
Definition ProcessorFlags.hpp:69
@ MIPS_MACH_9000
Definition ProcessorFlags.hpp:87
@ RISCV_FLOAT_ABI_SINGLE
Definition ProcessorFlags.hpp:113
@ MIPS_MACH_OCTEON2
Definition ProcessorFlags.hpp:82
@ MIPS_ARCH_5
Definition ProcessorFlags.hpp:102
@ RISCV_FLOAT_ABI_DOUBLE
Definition ProcessorFlags.hpp:114
@ MIPS_NAN2008
Definition ProcessorFlags.hpp:64
@ MIPS_ABI_O32
Definition ProcessorFlags.hpp:67
@ MIPS_ARCH_32
Definition ProcessorFlags.hpp:103
@ MIPS_ABI2
Definition ProcessorFlags.hpp:59
@ MIPS_MACH_4010
Definition ProcessorFlags.hpp:74
@ MIPS_ARCH_ASE_MDMX
Definition ProcessorFlags.hpp:95
@ MIPS_MACH_4100
Definition ProcessorFlags.hpp:75
@ ARM_SOFT_FLOAT
Definition ProcessorFlags.hpp:34
@ MIPS_ABI_EABI64
Definition ProcessorFlags.hpp:70
@ MIPS_MACH_LS3A
Definition ProcessorFlags.hpp:90
@ ARM_EABI_VER4
Definition ProcessorFlags.hpp:39
@ MIPS_ARCH_64R6
Definition ProcessorFlags.hpp:108
@ LOONGARCH_ABI_DOUBLE_FLOAT
Definition ProcessorFlags.hpp:54
@ MIPS_ARCH_64
Definition ProcessorFlags.hpp:104
@ MIPS_MACH_XLR
Definition ProcessorFlags.hpp:81
@ HEXAGON_MACH_V5
Definition ProcessorFlags.hpp:45
@ LOONGARCH_ABI_SOFT_FLOAT
Definition ProcessorFlags.hpp:52
@ MIPS_ARCH_32R2
Definition ProcessorFlags.hpp:105
@ MIPS_ARCH_1
Definition ProcessorFlags.hpp:98
@ MIPS_ABI_O64
Definition ProcessorFlags.hpp:68
@ ARM_EABI_VER2
Definition ProcessorFlags.hpp:37
@ HEXAGON_MACH_V4
Definition ProcessorFlags.hpp:44
@ MIPS_MACH_SB1
Definition ProcessorFlags.hpp:79
@ ARM_EABI_UNKNOWN
Definition ProcessorFlags.hpp:33
@ MIPS_MACH_LS2E
Definition ProcessorFlags.hpp:88
@ RISCV_FLOAT_ABI_TSO
Definition ProcessorFlags.hpp:118
@ MIPS_ARCH_64R2
Definition ProcessorFlags.hpp:106
@ MIPS_ARCH_32R6
Definition ProcessorFlags.hpp:107
@ MIPS_ARCH_ASE_M16
Definition ProcessorFlags.hpp:94
@ MIPS_MACH_5500
Definition ProcessorFlags.hpp:86
@ HEXAGON_MACH_V3
Definition ProcessorFlags.hpp:43
@ MIPS_CPIC
Definition ProcessorFlags.hpp:58
@ ARM_VFP_FLOAT
Definition ProcessorFlags.hpp:35
@ RISCV_RVC
Definition ProcessorFlags.hpp:110
@ HEXAGON_ISA_V5
Definition ProcessorFlags.hpp:50
@ MIPS_MACH_5900
Definition ProcessorFlags.hpp:85
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41