LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
X86ISA.hpp
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_NOTE_DETAILS_PROPERTIES_X86ISA_H
17#define LIEF_ELF_NOTE_DETAILS_PROPERTIES_X86ISA_H
18#include <vector>
19#include <utility>
20
21#include "LIEF/ELF/NoteDetails/NoteGnuProperty.hpp"
22
23namespace LIEF {
24namespace ELF {
25
35 public:
36 enum class FLAG {
37 NONE = 0,
38 USED,
39 NEEDED,
40 };
41 enum class ISA {
42 UNKNOWN = 0,
43 BASELINE,
44 V2,
45 V3,
46 V4,
47
48 CMOV,
49 FMA,
50 I486,
51 I586,
52 I686,
53 SSE,
54 SSE2,
55 SSE3,
56 SSSE3,
57 SSE4_1,
58 SSE4_2,
59 AVX,
60 AVX2,
61 AVX512F,
62 AVX512CD,
63 AVX512ER,
64 AVX512PF,
65 AVX512VL,
66 AVX512DQ,
67 AVX512BW,
68 AVX512_4FMAPS,
69 AVX512_4VNNIW,
70 AVX512_BITALG,
71 AVX512_IFMA,
72 AVX512_VBMI,
73 AVX512_VBMI2,
74 AVX512_VNNI,
75 AVX512_BF16,
76 };
77 using values_t = std::vector<std::pair<FLAG, ISA>>;
78
79 static bool classof(const NoteGnuProperty::Property* prop) {
81 }
82
83 static std::unique_ptr<X86ISA> create(uint32_t type, BinaryStream& stream);
84
86 const values_t& values() const {
87 return values_;
88 }
89
90 ~X86ISA() override = default;
91
92 void dump(std::ostream &os) const override;
93
94 protected:
95 inline static std::unique_ptr<X86ISA>
96 create_isa_1(FLAG flag, BinaryStream& stream);
97 inline static std::unique_ptr<X86ISA>
98 create_compat_isa_1(FLAG flag, BinaryStream& stream, bool is_compat2);
99 X86ISA(values_t values) :
100 NoteGnuProperty::Property(NoteGnuProperty::Property::TYPE::X86_ISA),
101 values_(std::move(values))
102 {}
103
104 values_t values_;
105};
106
107LIEF_API const char* to_string(X86ISA::FLAG flag);
108LIEF_API const char* to_string(X86ISA::ISA isa);
109
110}
111}
112
113#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:34
This class wraps the different properties that can be used in a NT_GNU_PROPERTY_TYPE_0 note.
Definition NoteGnuProperty.hpp:35
TYPE
LIEF's mirror types of the original GNU_PROPERTY_ values.
Definition NoteGnuProperty.hpp:39
@ X86_ISA
Mirror of GNU_PROPERTY_X86_ISA_1_* and GNU_PROPERTY_X86_COMPAT_*
TYPE type() const
Return the LIEF's mirror type of the note.
Definition NoteGnuProperty.hpp:51
Class that wraps the NT_GNU_PROPERTY_TYPE_0 note.
Definition NoteGnuProperty.hpp:30
This class interfaces the different GNU_PROPERTY_X86_ISA_* properties which includes:
Definition X86ISA.hpp:34
const values_t & values() const
List of the ISA values in this property.
Definition X86ISA.hpp:86
LIEF namespace.
Definition Abstract/Binary.hpp:32