Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/dep/zydis/src/Zydis.c
4212 views
1
/***************************************************************************************************
2
3
Zyan Disassembler Library (Zydis)
4
5
Original Author : Florian Bernd
6
7
* Permission is hereby granted, free of charge, to any person obtaining a copy
8
* of this software and associated documentation files (the "Software"), to deal
9
* in the Software without restriction, including without limitation the rights
10
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
* copies of the Software, and to permit persons to whom the Software is
12
* furnished to do so, subject to the following conditions:
13
*
14
* The above copyright notice and this permission notice shall be included in all
15
* copies or substantial portions of the Software.
16
*
17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
* SOFTWARE.
24
25
***************************************************************************************************/
26
27
#include <Zydis/Zydis.h>
28
29
/* ============================================================================================== */
30
/* Exported functions */
31
/* ============================================================================================== */
32
33
ZyanU64 ZydisGetVersion(void)
34
{
35
return ZYDIS_VERSION;
36
}
37
38
ZyanStatus ZydisIsFeatureEnabled(ZydisFeature feature)
39
{
40
switch (feature)
41
{
42
case ZYDIS_FEATURE_DECODER:
43
#ifndef ZYDIS_DISABLE_DECODER
44
return ZYAN_STATUS_TRUE;
45
#else
46
return ZYAN_STATUS_FALSE;
47
#endif
48
case ZYDIS_FEATURE_ENCODER:
49
#ifndef ZYDIS_DISABLE_ENCODER
50
return ZYAN_STATUS_TRUE;
51
#else
52
return ZYAN_STATUS_FALSE;
53
#endif
54
case ZYDIS_FEATURE_FORMATTER:
55
#ifndef ZYDIS_DISABLE_FORMATTER
56
return ZYAN_STATUS_TRUE;
57
#else
58
return ZYAN_STATUS_FALSE;
59
#endif
60
case ZYDIS_FEATURE_AVX512:
61
#ifndef ZYDIS_DISABLE_AVX512
62
return ZYAN_STATUS_TRUE;
63
#else
64
return ZYAN_STATUS_FALSE;
65
#endif
66
67
case ZYDIS_FEATURE_KNC:
68
#ifndef ZYDIS_DISABLE_KNC
69
return ZYAN_STATUS_TRUE;
70
#else
71
return ZYAN_STATUS_FALSE;
72
#endif
73
74
case ZYDIS_FEATURE_SEGMENT:
75
#ifndef ZYDIS_DISABLE_SEGMENT
76
return ZYAN_STATUS_TRUE;
77
#else
78
return ZYAN_STATUS_FALSE;
79
#endif
80
81
default:
82
return ZYAN_STATUS_INVALID_ARGUMENT;
83
}
84
}
85
86
/* ============================================================================================== */
87
88