LIEF: Library to Instrument Executable Formats Version 0.15.1
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
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,
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,
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);
100 NoteGnuProperty::Property(NoteGnuProperty::Property::TYPE::X86_ISA),
101 values_(std::move(values))
102 {}
103
104 values_t values_;
105};
106
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
void dump(std::ostream &os) const override
ISA
Definition X86ISA.hpp:41
static std::unique_ptr< X86ISA > create(uint32_t type, BinaryStream &stream)
~X86ISA() override=default
std::vector< std::pair< FLAG, ISA > > values_t
Definition X86ISA.hpp:77
FLAG
Definition X86ISA.hpp:36
const values_t & values() const
List of the ISA values in this property.
Definition X86ISA.hpp:86
static bool classof(const NoteGnuProperty::Property *prop)
Definition X86ISA.hpp:79
const char * to_string(DynamicEntry::TAG e)
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41