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