xref: /haiku/src/libs/zydis/Zydis/MetaInfo.c (revision 1003e004e6c97eb60657a98928dd334e141c59ee)
1*1003e004SJérôme Duval /***************************************************************************************************
2*1003e004SJérôme Duval 
3*1003e004SJérôme Duval   Zyan Disassembler Library (Zydis)
4*1003e004SJérôme Duval 
5*1003e004SJérôme Duval   Original Author : Florian Bernd
6*1003e004SJérôme Duval 
7*1003e004SJérôme Duval  * Permission is hereby granted, free of charge, to any person obtaining a copy
8*1003e004SJérôme Duval  * of this software and associated documentation files (the "Software"), to deal
9*1003e004SJérôme Duval  * in the Software without restriction, including without limitation the rights
10*1003e004SJérôme Duval  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11*1003e004SJérôme Duval  * copies of the Software, and to permit persons to whom the Software is
12*1003e004SJérôme Duval  * furnished to do so, subject to the following conditions:
13*1003e004SJérôme Duval  *
14*1003e004SJérôme Duval  * The above copyright notice and this permission notice shall be included in all
15*1003e004SJérôme Duval  * copies or substantial portions of the Software.
16*1003e004SJérôme Duval  *
17*1003e004SJérôme Duval  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18*1003e004SJérôme Duval  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19*1003e004SJérôme Duval  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20*1003e004SJérôme Duval  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21*1003e004SJérôme Duval  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22*1003e004SJérôme Duval  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23*1003e004SJérôme Duval  * SOFTWARE.
24*1003e004SJérôme Duval 
25*1003e004SJérôme Duval ***************************************************************************************************/
26*1003e004SJérôme Duval 
27*1003e004SJérôme Duval #include <Zydis/MetaInfo.h>
28*1003e004SJérôme Duval #include <Zycore/Types.h>
29*1003e004SJérôme Duval 
30*1003e004SJérôme Duval /* ============================================================================================== */
31*1003e004SJérôme Duval /* Enum strings                                                                                   */
32*1003e004SJérôme Duval /* ============================================================================================== */
33*1003e004SJérôme Duval 
34*1003e004SJérôme Duval #include <Generated/EnumInstructionCategory.inc>
35*1003e004SJérôme Duval #include <Generated/EnumISASet.inc>
36*1003e004SJérôme Duval #include <Generated/EnumISAExt.inc>
37*1003e004SJérôme Duval 
38*1003e004SJérôme Duval /* ============================================================================================== */
39*1003e004SJérôme Duval /* Exported functions                                                                             */
40*1003e004SJérôme Duval /* ============================================================================================== */
41*1003e004SJérôme Duval 
ZydisCategoryGetString(ZydisInstructionCategory category)42*1003e004SJérôme Duval const char* ZydisCategoryGetString(ZydisInstructionCategory category)
43*1003e004SJérôme Duval {
44*1003e004SJérôme Duval     if ((ZyanUSize)category >= ZYAN_ARRAY_LENGTH(STR_INSTRUCTIONCATEGORY))
45*1003e004SJérôme Duval     {
46*1003e004SJérôme Duval         return ZYAN_NULL;
47*1003e004SJérôme Duval     }
48*1003e004SJérôme Duval     return STR_INSTRUCTIONCATEGORY[category];
49*1003e004SJérôme Duval }
50*1003e004SJérôme Duval 
ZydisISASetGetString(ZydisISASet isa_set)51*1003e004SJérôme Duval const char* ZydisISASetGetString(ZydisISASet isa_set)
52*1003e004SJérôme Duval {
53*1003e004SJérôme Duval     if ((ZyanUSize)isa_set >= ZYAN_ARRAY_LENGTH(STR_ISASET))
54*1003e004SJérôme Duval     {
55*1003e004SJérôme Duval         return ZYAN_NULL;
56*1003e004SJérôme Duval     }
57*1003e004SJérôme Duval     return STR_ISASET[isa_set];
58*1003e004SJérôme Duval }
59*1003e004SJérôme Duval 
ZydisISAExtGetString(ZydisISAExt isa_ext)60*1003e004SJérôme Duval const char* ZydisISAExtGetString(ZydisISAExt isa_ext)
61*1003e004SJérôme Duval {
62*1003e004SJérôme Duval     if ((ZyanUSize)isa_ext >= ZYAN_ARRAY_LENGTH(STR_ISAEXT))
63*1003e004SJérôme Duval     {
64*1003e004SJérôme Duval         return ZYAN_NULL;
65*1003e004SJérôme Duval     }
66*1003e004SJérôme Duval     return STR_ISAEXT[isa_ext];
67*1003e004SJérôme Duval }
68*1003e004SJérôme Duval 
69*1003e004SJérôme Duval /* ============================================================================================== */
70