LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
X86Feature.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2025 R. Thomas
2 * Copyright 2017 - 2025 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_X86FEATURES_H
17#define LIEF_ELF_NOTE_DETAILS_PROPERTIES_X86FEATURES_H
18#include <vector>
19#include <utility>
20
22#include "LIEF/visibility.h"
23
24namespace LIEF {
25namespace ELF {
26
32class LIEF_API X86Features : public NoteGnuProperty::Property {
33 public:
34
36 enum class FLAG {
37 NONE = 0,
40 };
41
63
69 using features_t = std::vector<std::pair<FLAG, FEATURE>>;
70
71 static bool classof(const NoteGnuProperty::Property* prop) {
73 }
74
75 static std::unique_ptr<X86Features> create(uint32_t type, BinaryStream& stream);
76
78 const features_t& features() const {
79 return features_;
80 }
81
82 void dump(std::ostream &os) const override;
83
84 ~X86Features() override = default;
85
86 protected:
87 inline static std::unique_ptr<X86Features> create_feat1(FLAG flag, BinaryStream& stream);
88 inline static std::unique_ptr<X86Features> create_feat2(FLAG flag, BinaryStream& stream);
89 X86Features(features_t values) :
90 NoteGnuProperty::Property(NoteGnuProperty::Property::TYPE::X86_FEATURE),
91 features_(std::move(values))
92 {}
93
94 features_t features_;
95};
96
99
100}
101}
102
103#endif
Class that is used to a read stream of data from different sources.
Definition BinaryStream.hpp:33
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_FEATURE
Mirror of GNU_PROPERTY_X86_FEATURE_*.
Definition NoteGnuProperty.hpp:47
TYPE type() const
Return the LIEF's mirror type of the note.
Definition NoteGnuProperty.hpp:52
Class that wraps the NT_GNU_PROPERTY_TYPE_0 note.
Definition NoteGnuProperty.hpp:30
static std::unique_ptr< X86Features > create(uint32_t type, BinaryStream &stream)
static bool classof(const NoteGnuProperty::Property *prop)
Definition X86Feature.hpp:71
FLAG
Flag according to the _AND, _USED or _NEEDED suffixes.
Definition X86Feature.hpp:36
@ NEEDED
For the original GNU_PROPERTY_X86_FEATURE_2_NEEDED property.
Definition X86Feature.hpp:39
@ NONE
For the original GNU_PROPERTY_X86_FEATURE_1_AND property.
Definition X86Feature.hpp:37
@ USED
For the original GNU_PROPERTY_X86_FEATURE_2_USED property.
Definition X86Feature.hpp:38
const features_t & features() const
List of the features.
Definition X86Feature.hpp:78
void dump(std::ostream &os) const override
FEATURE
Features provided by these different properties.
Definition X86Feature.hpp:43
@ MASK
Definition X86Feature.hpp:61
@ YMM
Definition X86Feature.hpp:54
@ XSAVE
Definition X86Feature.hpp:57
@ MMX
Definition X86Feature.hpp:52
@ LAM_U57
Definition X86Feature.hpp:49
@ XSAVEC
Definition X86Feature.hpp:59
@ UNKNOWN
Definition X86Feature.hpp:44
@ ZMM
Definition X86Feature.hpp:55
@ FXSR
Definition X86Feature.hpp:56
@ XMM
Definition X86Feature.hpp:53
@ TMM
Definition X86Feature.hpp:60
@ SHSTK
Definition X86Feature.hpp:47
@ X87
Definition X86Feature.hpp:51
@ IBT
Definition X86Feature.hpp:46
@ LAM_U48
Definition X86Feature.hpp:48
@ XSAVEOPT
Definition X86Feature.hpp:58
@ X86
Definition X86Feature.hpp:50
std::vector< std::pair< FLAG, FEATURE > > features_t
List of the features as a pair of FLAG, FEATURE.
Definition X86Feature.hpp:69
~X86Features() override=default
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:28
const char * to_string(DynamicEntry::TAG e)
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:41