Coverage Report

Created: 2026-09-28 06:34

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/capstonenext/arch/RISCV/RISCVDisassembler.c
Line
Count
Source
1
/* Capstone Disassembly Engine, http://www.capstone-engine.org */
2
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2022, */
3
/*    Rot127 <unisono@quyllur.org> 2022-2023 */
4
/* Automatically translated source file from LLVM. */
5
6
/* LLVM-commit: <commit> */
7
/* LLVM-tag: <tag> */
8
9
/* Only small edits allowed. */
10
/* For multiple similar edits, please create a Patch for the translator. */
11
12
/* Capstone's C++ file translator: */
13
/* https://github.com/capstone-engine/capstone/tree/next/suite/auto-sync */
14
15
//===-- RISCVDisassembler.cpp - Disassembler for RISC-V -------------------===//
16
//
17
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
18
// See https://llvm.org/LICENSE.txt for license information.
19
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
20
//
21
//===----------------------------------------------------------------------===//
22
//
23
// This file implements the RISCVDisassembler class.
24
//
25
//===----------------------------------------------------------------------===//
26
27
#include <stdio.h>
28
#include <string.h>
29
#include <stdlib.h>
30
#include <capstone/platform.h>
31
32
#include "../../MCInst.h"
33
#include "../../MathExtras.h"
34
#include "../../MCInstPrinter.h"
35
#include "../../MCDisassembler.h"
36
#include "../../MCFixedLenDisassembler.h"
37
#include "../../cs_priv.h"
38
#include "../../utils.h"
39
#include "RISCVDisassemblerExtension.h"
40
#include "RISCVBaseInfo.h"
41
#include "RISCVMapping.h"
42
43
#define GET_SUBTARGETINFO_ENUM
44
#include "RISCVGenSubtargetInfo.inc"
45
46
#define GET_REGINFO_ENUM
47
#include "RISCVGenRegisterInfo.inc"
48
49
#define GET_INSTRINFO_ENUM
50
#define GET_INSTRINFO_MC_DESC
51
#include "RISCVGenInstrInfo.inc"
52
53
4.92k
#define CONCAT(a, b) CONCAT_(a, b)
54
4.92k
#define CONCAT_(a, b) a##_##b
55
56
#define DEBUG_TYPE "riscv-disassembler"
57
58
DecodeStatus RISCV_getInstruction(MCInst *Instr, uint16_t *Size,
59
          const uint8_t *Bytes, size_t BytesLen,
60
          uint64_t Address, SStream *CStream);
61
void addSPOperands(MCInst *MI);
62
;
63
// end anonymous namespace
64
65
static DecodeStatus DecodeGPRRegisterClass(MCInst *Inst, uint32_t RegNo,
66
             uint64_t Address,
67
             const void *Decoder)
68
39.0k
{
69
39.0k
  bool IsRVE = RISCV_getFeatureBits(Inst->csh->mode, RISCV_FeatureRVE);
70
71
39.0k
  if (RegNo >= 32 || (IsRVE && RegNo >= 16))
72
0
    return MCDisassembler_Fail;
73
74
39.0k
  MCRegister Reg = RISCV_X0 + RegNo;
75
39.0k
  MCOperand_CreateReg0(Inst, (Reg));
76
39.0k
  return MCDisassembler_Success;
77
39.0k
}
78
79
static DecodeStatus DecodeGPRX1X5RegisterClass(MCInst *Inst, uint32_t RegNo,
80
                 uint64_t Address,
81
                 const void *Decoder)
82
0
{
83
0
  MCRegister Reg = RISCV_X0 + RegNo;
84
0
  if (Reg != RISCV_X1 && Reg != RISCV_X5)
85
0
    return MCDisassembler_Fail;
86
87
0
  MCOperand_CreateReg0(Inst, (Reg));
88
0
  return MCDisassembler_Success;
89
0
}
90
91
static DecodeStatus DecodeFPR16RegisterClass(MCInst *Inst, uint32_t RegNo,
92
               uint64_t Address,
93
               const void *Decoder)
94
3.72k
{
95
3.72k
  if (RegNo >= 32)
96
0
    return MCDisassembler_Fail;
97
98
3.72k
  MCRegister Reg = RISCV_F0_H + RegNo;
99
3.72k
  MCOperand_CreateReg0(Inst, (Reg));
100
3.72k
  return MCDisassembler_Success;
101
3.72k
}
102
103
static DecodeStatus DecodeFPR32RegisterClass(MCInst *Inst, uint32_t RegNo,
104
               uint64_t Address,
105
               const void *Decoder)
106
1.24k
{
107
1.24k
  if (RegNo >= 32)
108
0
    return MCDisassembler_Fail;
109
110
1.24k
  MCRegister Reg = RISCV_F0_F + RegNo;
111
1.24k
  MCOperand_CreateReg0(Inst, (Reg));
112
1.24k
  return MCDisassembler_Success;
113
1.24k
}
114
115
static DecodeStatus DecodeFPR32CRegisterClass(MCInst *Inst, uint32_t RegNo,
116
                uint64_t Address,
117
                const void *Decoder)
118
0
{
119
0
  if (RegNo >= 8) {
120
0
    return MCDisassembler_Fail;
121
0
  }
122
0
  MCRegister Reg = RISCV_F8_F + RegNo;
123
0
  MCOperand_CreateReg0(Inst, (Reg));
124
0
  return MCDisassembler_Success;
125
0
}
126
127
static DecodeStatus DecodeFPR64RegisterClass(MCInst *Inst, uint32_t RegNo,
128
               uint64_t Address,
129
               const void *Decoder)
130
0
{
131
0
  if (RegNo >= 32)
132
0
    return MCDisassembler_Fail;
133
134
0
  MCRegister Reg = RISCV_F0_D + RegNo;
135
0
  MCOperand_CreateReg0(Inst, (Reg));
136
0
  return MCDisassembler_Success;
137
0
}
138
139
static DecodeStatus DecodeFPR64CRegisterClass(MCInst *Inst, uint32_t RegNo,
140
                uint64_t Address,
141
                const void *Decoder)
142
0
{
143
0
  if (RegNo >= 8) {
144
0
    return MCDisassembler_Fail;
145
0
  }
146
0
  MCRegister Reg = RISCV_F8_D + RegNo;
147
0
  MCOperand_CreateReg0(Inst, (Reg));
148
0
  return MCDisassembler_Success;
149
0
}
150
151
static DecodeStatus DecodeGPRNoX0RegisterClass(MCInst *Inst, uint32_t RegNo,
152
                 uint64_t Address,
153
                 const void *Decoder)
154
12.3k
{
155
12.3k
  if (RegNo == 0) {
156
8
    return MCDisassembler_Fail;
157
8
  }
158
159
12.3k
  return DecodeGPRRegisterClass(Inst, RegNo, Address, Decoder);
160
12.3k
}
161
162
static DecodeStatus DecodeGPRNoX0X2RegisterClass(MCInst *Inst, uint64_t RegNo,
163
             uint32_t Address,
164
             const void *Decoder)
165
1.27k
{
166
1.27k
  if (RegNo == 2) {
167
0
    return MCDisassembler_Fail;
168
0
  }
169
170
1.27k
  return DecodeGPRNoX0RegisterClass(Inst, RegNo, Address, Decoder);
171
1.27k
}
172
173
static DecodeStatus DecodeGPRCRegisterClass(MCInst *Inst, uint32_t RegNo,
174
              uint64_t Address,
175
              const void *Decoder)
176
21.7k
{
177
21.7k
  if (RegNo >= 8)
178
0
    return MCDisassembler_Fail;
179
180
21.7k
  MCRegister Reg = RISCV_X8 + RegNo;
181
21.7k
  MCOperand_CreateReg0(Inst, (Reg));
182
21.7k
  return MCDisassembler_Success;
183
21.7k
}
184
185
static DecodeStatus DecodeGPRPairRegisterClass(MCInst *Inst, uint32_t RegNo,
186
                 uint64_t Address,
187
                 const void *Decoder)
188
1.09k
{
189
1.09k
  if (RegNo >= 32 || RegNo & 1)
190
2
    return MCDisassembler_Fail;
191
192
1.09k
  MCRegister Reg = RISCV_X0 + RegNo;
193
1.09k
  MCOperand_CreateReg0(Inst, (Reg));
194
1.09k
  return MCDisassembler_Success;
195
1.09k
}
196
197
static DecodeStatus DecodeSR07RegisterClass(MCInst *Inst, uint64_t RegNo,
198
              uint64_t Address,
199
              const void *Decoder)
200
0
{
201
0
  if (RegNo >= 8)
202
0
    return MCDisassembler_Fail;
203
204
0
  MCRegister Reg = (RegNo < 2) ? (RegNo + RISCV_X8) :
205
0
               (RegNo - 2 + RISCV_X18);
206
0
  MCOperand_CreateReg0(Inst, (Reg));
207
0
  return MCDisassembler_Success;
208
0
}
209
210
static DecodeStatus DecodeVRRegisterClass(MCInst *Inst, uint32_t RegNo,
211
            uint64_t Address, const void *Decoder)
212
7.62k
{
213
7.62k
  if (RegNo >= 32)
214
0
    return MCDisassembler_Fail;
215
216
7.62k
  MCRegister Reg = RISCV_V0 + RegNo;
217
7.62k
  MCOperand_CreateReg0(Inst, (Reg));
218
7.62k
  return MCDisassembler_Success;
219
7.62k
}
220
221
static DecodeStatus DecodeVRM2RegisterClass(MCInst *Inst, uint32_t RegNo,
222
              uint64_t Address,
223
              const void *Decoder)
224
454
{
225
454
  if (RegNo >= 32 || RegNo % 2)
226
3
    return MCDisassembler_Fail;
227
228
451
  MCRegister Reg = MCRegisterInfo_getMatchingSuperReg(
229
451
    Inst->MRI, RISCV_V0 + RegNo, RISCV_sub_vrm1_0,
230
451
    MCRegisterInfo_getRegClass(Inst->MRI, RISCV_VRM2RegClassID));
231
232
451
  MCOperand_CreateReg0(Inst, (Reg));
233
451
  return MCDisassembler_Success;
234
454
}
235
236
static DecodeStatus DecodeVRM4RegisterClass(MCInst *Inst, uint32_t RegNo,
237
              uint64_t Address,
238
              const void *Decoder)
239
28
{
240
28
  if (RegNo >= 32 || RegNo % 4)
241
2
    return MCDisassembler_Fail;
242
243
26
  MCRegister Reg = MCRegisterInfo_getMatchingSuperReg(
244
26
    Inst->MRI, RISCV_V0 + RegNo, RISCV_sub_vrm1_0,
245
26
    MCRegisterInfo_getRegClass(Inst->MRI, RISCV_VRM4RegClassID));
246
247
26
  MCOperand_CreateReg0(Inst, (Reg));
248
26
  return MCDisassembler_Success;
249
28
}
250
251
static DecodeStatus DecodeVRM8RegisterClass(MCInst *Inst, uint32_t RegNo,
252
              uint64_t Address,
253
              const void *Decoder)
254
252
{
255
252
  if (RegNo >= 32 || RegNo % 8)
256
0
    return MCDisassembler_Fail;
257
258
252
  MCRegister Reg = MCRegisterInfo_getMatchingSuperReg(
259
252
    Inst->MRI, RISCV_V0 + RegNo, RISCV_sub_vrm1_0,
260
252
    MCRegisterInfo_getRegClass(Inst->MRI, RISCV_VRM8RegClassID));
261
262
252
  MCOperand_CreateReg0(Inst, (Reg));
263
252
  return MCDisassembler_Success;
264
252
}
265
266
static DecodeStatus decodeVMaskReg(MCInst *Inst, uint64_t RegNo,
267
           uint64_t Address, const void *Decoder)
268
2.76k
{
269
2.76k
  if (RegNo > 2) {
270
0
    return MCDisassembler_Fail;
271
0
  }
272
2.76k
  MCRegister Reg = (RegNo == 0) ? RISCV_V0 : RISCV_NoRegister;
273
274
2.76k
  MCOperand_CreateReg0(Inst, (Reg));
275
2.76k
  return MCDisassembler_Success;
276
2.76k
}
277
278
#define DEFINE_decodeUImmOperand(N) \
279
  static DecodeStatus CONCAT(decodeUImmOperand, \
280
           N)(MCInst * Inst, uint32_t Imm, \
281
              int64_t Address, const void *Decoder) \
282
18.1k
  { \
283
18.1k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
18.1k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
18.1k
    return MCDisassembler_Success; \
286
18.1k
  }
RISCVDisassembler.c:decodeUImmOperand_8
Line
Count
Source
282
3.49k
  { \
283
3.49k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
3.49k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
3.49k
    return MCDisassembler_Success; \
286
3.49k
  }
RISCVDisassembler.c:decodeUImmOperand_9
Line
Count
Source
282
1.66k
  { \
283
1.66k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
1.66k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
1.66k
    return MCDisassembler_Success; \
286
1.66k
  }
RISCVDisassembler.c:decodeUImmOperand_7
Line
Count
Source
282
2.56k
  { \
283
2.56k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
2.56k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
2.56k
    return MCDisassembler_Success; \
286
2.56k
  }
RISCVDisassembler.c:decodeUImmOperand_2
Line
Count
Source
282
1.28k
  { \
283
1.28k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
1.28k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
1.28k
    return MCDisassembler_Success; \
286
1.28k
  }
RISCVDisassembler.c:decodeUImmOperand_4
Line
Count
Source
282
1.38k
  { \
283
1.38k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
1.38k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
1.38k
    return MCDisassembler_Success; \
286
1.38k
  }
RISCVDisassembler.c:decodeUImmOperand_20
Line
Count
Source
282
689
  { \
283
689
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
689
    MCOperand_CreateImm0(Inst, (Imm)); \
285
689
    return MCDisassembler_Success; \
286
689
  }
RISCVDisassembler.c:decodeUImmOperand_5
Line
Count
Source
282
1.59k
  { \
283
1.59k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
1.59k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
1.59k
    return MCDisassembler_Success; \
286
1.59k
  }
RISCVDisassembler.c:decodeUImmOperand_6
Line
Count
Source
282
471
  { \
283
471
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
471
    MCOperand_CreateImm0(Inst, (Imm)); \
285
471
    return MCDisassembler_Success; \
286
471
  }
RISCVDisassembler.c:decodeUImmOperand_11
Line
Count
Source
282
1.54k
  { \
283
1.54k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
1.54k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
1.54k
    return MCDisassembler_Success; \
286
1.54k
  }
RISCVDisassembler.c:decodeUImmOperand_10
Line
Count
Source
282
2.85k
  { \
283
2.85k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
2.85k
    MCOperand_CreateImm0(Inst, (Imm)); \
285
2.85k
    return MCDisassembler_Success; \
286
2.85k
  }
RISCVDisassembler.c:decodeUImmOperand_12
Line
Count
Source
282
529
  { \
283
529
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
529
    MCOperand_CreateImm0(Inst, (Imm)); \
285
529
    return MCDisassembler_Success; \
286
529
  }
RISCVDisassembler.c:decodeUImmOperand_3
Line
Count
Source
282
33
  { \
283
33
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
284
33
    MCOperand_CreateImm0(Inst, (Imm)); \
285
33
    return MCDisassembler_Success; \
286
33
  }
Unexecuted instantiation: RISCVDisassembler.c:decodeUImmOperand_1
287
DEFINE_decodeUImmOperand(6);
288
DEFINE_decodeUImmOperand(2);
289
DEFINE_decodeUImmOperand(8);
290
DEFINE_decodeUImmOperand(9);
291
DEFINE_decodeUImmOperand(7);
292
DEFINE_decodeUImmOperand(4);
293
DEFINE_decodeUImmOperand(20);
294
DEFINE_decodeUImmOperand(5);
295
DEFINE_decodeUImmOperand(11);
296
DEFINE_decodeUImmOperand(10);
297
DEFINE_decodeUImmOperand(12);
298
DEFINE_decodeUImmOperand(3);
299
DEFINE_decodeUImmOperand(1);
300
301
#define DEFINE_decodeUImmNonZeroOperand(N) \
302
  static DecodeStatus CONCAT(decodeUImmNonZeroOperand, \
303
           N)(MCInst * Inst, uint32_t Imm, \
304
              int64_t Address, const void *Decoder) \
305
2.81k
  { \
306
2.81k
    if (Imm == 0) \
307
2.81k
      return MCDisassembler_Fail; \
308
2.81k
    return CONCAT(decodeUImmOperand, N)(Inst, Imm, Address, \
309
2.80k
                Decoder); \
310
2.81k
  }
311
DEFINE_decodeUImmNonZeroOperand(10);
312
313
#define DEFINE_decodeSImmOperand(N) \
314
  static DecodeStatus CONCAT(decodeSImmOperand, \
315
           N)(MCInst * Inst, uint32_t Imm, \
316
              int64_t Address, const void *Decoder) \
317
7.06k
  { \
318
7.06k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
7.06k
\
320
7.06k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
7.06k
    return MCDisassembler_Success; \
322
7.06k
  }
RISCVDisassembler.c:decodeSImmOperand_6
Line
Count
Source
317
3.97k
  { \
318
3.97k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
3.97k
\
320
3.97k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
3.97k
    return MCDisassembler_Success; \
322
3.97k
  }
RISCVDisassembler.c:decodeSImmOperand_10
Line
Count
Source
317
271
  { \
318
271
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
271
\
320
271
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
271
    return MCDisassembler_Success; \
322
271
  }
RISCVDisassembler.c:decodeSImmOperand_12
Line
Count
Source
317
2.16k
  { \
318
2.16k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
2.16k
\
320
2.16k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
2.16k
    return MCDisassembler_Success; \
322
2.16k
  }
RISCVDisassembler.c:decodeSImmOperand_5
Line
Count
Source
317
659
  { \
318
659
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
319
659
\
320
659
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm), N))); \
321
659
    return MCDisassembler_Success; \
322
659
  }
323
DEFINE_decodeSImmOperand(6);
324
DEFINE_decodeSImmOperand(12);
325
DEFINE_decodeSImmOperand(5);
326
DEFINE_decodeSImmOperand(10);
327
328
#define DEFINE_decodeSImmNonZeroOperand(N) \
329
  static DecodeStatus CONCAT(decodeSImmNonZeroOperand, \
330
           N)(MCInst * Inst, uint32_t Imm, \
331
              int64_t Address, const void *Decoder) \
332
1.74k
  { \
333
1.74k
    if (Imm == 0) \
334
1.74k
      return MCDisassembler_Fail; \
335
1.74k
    return CONCAT(decodeSImmOperand, N)(Inst, Imm, Address, \
336
1.74k
                Decoder); \
337
1.74k
  }
RISCVDisassembler.c:decodeSImmNonZeroOperand_6
Line
Count
Source
332
1.47k
  { \
333
1.47k
    if (Imm == 0) \
334
1.47k
      return MCDisassembler_Fail; \
335
1.47k
    return CONCAT(decodeSImmOperand, N)(Inst, Imm, Address, \
336
1.47k
                Decoder); \
337
1.47k
  }
RISCVDisassembler.c:decodeSImmNonZeroOperand_10
Line
Count
Source
332
274
  { \
333
274
    if (Imm == 0) \
334
274
      return MCDisassembler_Fail; \
335
274
    return CONCAT(decodeSImmOperand, N)(Inst, Imm, Address, \
336
271
                Decoder); \
337
274
  }
338
DEFINE_decodeSImmNonZeroOperand(6);
339
DEFINE_decodeSImmNonZeroOperand(10);
340
341
#define DEFINE_decodeSImmOperandAndLsl1(N) \
342
  static DecodeStatus CONCAT(decodeSImmOperandAndLsl1, \
343
           N)(MCInst * Inst, uint32_t Imm, \
344
              int64_t Address, const void *Decoder) \
345
3.67k
  { \
346
3.67k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
3.67k
\
348
3.67k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
3.67k
    return MCDisassembler_Success; \
350
3.67k
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_12
Line
Count
Source
345
1.05k
  { \
346
1.05k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
1.05k
\
348
1.05k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
1.05k
    return MCDisassembler_Success; \
350
1.05k
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_9
Line
Count
Source
345
1.84k
  { \
346
1.84k
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
1.84k
\
348
1.84k
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
1.84k
    return MCDisassembler_Success; \
350
1.84k
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_13
Line
Count
Source
345
516
  { \
346
516
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
516
\
348
516
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
516
    return MCDisassembler_Success; \
350
516
  }
RISCVDisassembler.c:decodeSImmOperandAndLsl1_21
Line
Count
Source
345
267
  { \
346
267
    CS_ASSERT(isUIntN(N, Imm) && "Invalid immediate"); \
347
267
\
348
267
    MCOperand_CreateImm0(Inst, (SignExtend64((Imm << 1), N))); \
349
267
    return MCDisassembler_Success; \
350
267
  }
351
DEFINE_decodeSImmOperandAndLsl1(12);
352
DEFINE_decodeSImmOperandAndLsl1(9);
353
DEFINE_decodeSImmOperandAndLsl1(13);
354
DEFINE_decodeSImmOperandAndLsl1(21);
355
356
static DecodeStatus decodeCLUIImmOperand(MCInst *Inst, uint32_t Imm,
357
           int64_t Address, const void *Decoder)
358
1.27k
{
359
1.27k
  CS_ASSERT(isUIntN(6, Imm) && "Invalid immediate");
360
1.27k
  if (Imm > 31) {
361
617
    Imm = (SignExtend64((Imm), 6) & 0xfffff);
362
617
  }
363
1.27k
  MCOperand_CreateImm0(Inst, (Imm));
364
1.27k
  return MCDisassembler_Success;
365
1.27k
}
366
367
static DecodeStatus decodeFRMArg(MCInst *Inst, uint32_t Imm, int64_t Address,
368
         const void *Decoder)
369
2.06k
{
370
2.06k
  CS_ASSERT(isUIntN(3, Imm) && "Invalid immediate");
371
2.06k
  if (!RISCVFPRndMode_isValidRoundingMode(Imm))
372
8
    return MCDisassembler_Fail;
373
374
2.06k
  MCOperand_CreateImm0(Inst, (Imm));
375
2.06k
  return MCDisassembler_Success;
376
2.06k
}
377
378
static DecodeStatus decodeRVCInstrRdRs1ImmZero(MCInst *Inst, uint32_t Insn,
379
                 uint64_t Address,
380
                 const void *Decoder);
381
382
static DecodeStatus decodeRVCInstrRdSImm(MCInst *Inst, uint32_t Insn,
383
           uint64_t Address, const void *Decoder);
384
385
static DecodeStatus decodeRVCInstrRdRs1UImm(MCInst *Inst, uint32_t Insn,
386
              uint64_t Address,
387
              const void *Decoder);
388
389
static DecodeStatus decodeRVCInstrRdRs2(MCInst *Inst, uint32_t Insn,
390
          uint64_t Address, const void *Decoder);
391
392
static DecodeStatus decodeRVCInstrRdRs1Rs2(MCInst *Inst, uint32_t Insn,
393
             uint64_t Address,
394
             const void *Decoder);
395
396
static DecodeStatus decodeXTHeadMemPair(MCInst *Inst, uint32_t Insn,
397
          uint64_t Address, const void *Decoder);
398
399
static DecodeStatus decodeZcmpRlist(MCInst *Inst, unsigned Imm,
400
            uint64_t Address, const void *Decoder);
401
402
static DecodeStatus decodeRegReg(MCInst *Inst, uint32_t Insn, uint64_t Address,
403
         const void *Decoder);
404
405
static DecodeStatus decodeZcmpSpimm(MCInst *Inst, unsigned Imm,
406
            uint64_t Address, const void *Decoder);
407
408
static DecodeStatus decodeCSSPushPopchk(MCInst *Inst, uint32_t Insn,
409
          uint64_t Address, const void *Decoder);
410
411
static DecodeStatus decodeUImmLog2XLenOperand(MCInst *Inst, uint32_t Imm,
412
                int64_t Address,
413
                const void *Decoder)
414
2.21k
{
415
2.21k
  CS_ASSERT(isUIntN(6, Imm) && "Invalid immediate");
416
417
2.21k
  if (!RISCV_getFeatureBits(Inst->csh->mode, RISCV_Feature64Bit) &&
418
602
      !isUIntN(5, Imm))
419
6
    return MCDisassembler_Fail;
420
421
2.20k
  MCOperand_CreateImm0(Inst, (Imm));
422
2.20k
  return MCDisassembler_Success;
423
2.21k
}
424
425
static DecodeStatus decodeUImmLog2XLenNonZeroOperand(MCInst *Inst, uint32_t Imm,
426
                 int64_t Address,
427
                 const void *Decoder)
428
1.85k
{
429
1.85k
  if (Imm == 0)
430
0
    return MCDisassembler_Fail;
431
1.85k
  return decodeUImmLog2XLenOperand(Inst, Imm, Address, Decoder);
432
1.85k
}
433
434
#include "RISCVGenDisassemblerTables.inc"
435
436
static DecodeStatus decodeRVCInstrRdRs1ImmZero(MCInst *Inst, uint32_t Insn,
437
                 uint64_t Address,
438
                 const void *Decoder)
439
769
{
440
769
  uint32_t Rd = fieldFromInstruction_4(Insn, 7, 5);
441
769
  if (DecodeGPRNoX0RegisterClass(Inst, Rd, Address, Decoder) ==
442
769
      MCDisassembler_Fail)
443
0
    return MCDisassembler_Fail;
444
769
  MCInst_addOperand2(Inst, (MCInst_getOperand(Inst, (0))));
445
769
  MCOperand_CreateImm0(Inst, (0));
446
769
  return MCDisassembler_Success;
447
769
}
448
449
static DecodeStatus decodeCSSPushPopchk(MCInst *Inst, uint32_t Insn,
450
          uint64_t Address, const void *Decoder)
451
0
{
452
0
  uint32_t Rs1 = fieldFromInstruction_4(Insn, 7, 5);
453
0
  DecodeStatus Result =
454
0
    DecodeGPRX1X5RegisterClass(Inst, Rs1, Address, Decoder);
455
0
  (void)Result;
456
0
  CS_ASSERT(Result == MCDisassembler_Success && "Invalid register");
457
0
  return MCDisassembler_Success;
458
0
}
459
460
static DecodeStatus decodeRVCInstrRdSImm(MCInst *Inst, uint32_t Insn,
461
           uint64_t Address, const void *Decoder)
462
160
{
463
160
  MCOperand_CreateReg0(Inst, (RISCV_X0));
464
160
  uint32_t SImm6 = fieldFromInstruction_4(Insn, 12, 1) << 5 |
465
160
       fieldFromInstruction_4(Insn, 2, 5);
466
160
  DecodeStatus Result =
467
160
    CONCAT(decodeSImmOperand, 6)(Inst, SImm6, Address, Decoder);
468
160
  (void)Result;
469
160
  CS_ASSERT(Result == MCDisassembler_Success && "Invalid immediate");
470
160
  return MCDisassembler_Success;
471
160
}
472
473
static DecodeStatus decodeRVCInstrRdRs1UImm(MCInst *Inst, uint32_t Insn,
474
              uint64_t Address,
475
              const void *Decoder)
476
211
{
477
211
  MCOperand_CreateReg0(Inst, (RISCV_X0));
478
211
  MCInst_addOperand2(Inst, (MCInst_getOperand(Inst, (0))));
479
211
  uint32_t UImm6 = fieldFromInstruction_4(Insn, 12, 1) << 5 |
480
211
       fieldFromInstruction_4(Insn, 2, 5);
481
211
  DecodeStatus Result =
482
211
    CONCAT(decodeUImmOperand, 6)(Inst, UImm6, Address, Decoder);
483
211
  (void)Result;
484
211
  CS_ASSERT(Result == MCDisassembler_Success && "Invalid immediate");
485
211
  return MCDisassembler_Success;
486
211
}
487
488
static DecodeStatus decodeRVCInstrRdRs2(MCInst *Inst, uint32_t Insn,
489
          uint64_t Address, const void *Decoder)
490
78
{
491
78
  uint32_t Rd = fieldFromInstruction_4(Insn, 7, 5);
492
78
  uint32_t Rs2 = fieldFromInstruction_4(Insn, 2, 5);
493
78
  if (DecodeGPRRegisterClass(Inst, Rd, Address, Decoder) ==
494
78
      MCDisassembler_Fail)
495
0
    return MCDisassembler_Fail;
496
78
  if (DecodeGPRRegisterClass(Inst, Rs2, Address, Decoder) ==
497
78
      MCDisassembler_Fail)
498
0
    return MCDisassembler_Fail;
499
78
  return MCDisassembler_Success;
500
78
}
501
502
static DecodeStatus decodeRVCInstrRdRs1Rs2(MCInst *Inst, uint32_t Insn,
503
             uint64_t Address,
504
             const void *Decoder)
505
88
{
506
88
  uint32_t Rd = fieldFromInstruction_4(Insn, 7, 5);
507
88
  uint32_t Rs2 = fieldFromInstruction_4(Insn, 2, 5);
508
88
  if (DecodeGPRRegisterClass(Inst, Rd, Address, Decoder) ==
509
88
      MCDisassembler_Fail)
510
0
    return MCDisassembler_Fail;
511
88
  MCInst_addOperand2(Inst, (MCInst_getOperand(Inst, (0))));
512
88
  if (DecodeGPRRegisterClass(Inst, Rs2, Address, Decoder) ==
513
88
      MCDisassembler_Fail)
514
0
    return MCDisassembler_Fail;
515
88
  return MCDisassembler_Success;
516
88
}
517
518
static DecodeStatus decodeXTHeadMemPair(MCInst *Inst, uint32_t Insn,
519
          uint64_t Address, const void *Decoder)
520
0
{
521
0
  uint32_t Rd1 = fieldFromInstruction_4(Insn, 7, 5);
522
0
  uint32_t Rs1 = fieldFromInstruction_4(Insn, 15, 5);
523
0
  uint32_t Rd2 = fieldFromInstruction_4(Insn, 20, 5);
524
0
  uint32_t UImm2 = fieldFromInstruction_4(Insn, 25, 2);
525
0
  if (DecodeGPRRegisterClass(Inst, Rd1, Address, Decoder) ==
526
0
      MCDisassembler_Fail)
527
0
    return MCDisassembler_Fail;
528
0
  if (DecodeGPRRegisterClass(Inst, Rd2, Address, Decoder) ==
529
0
      MCDisassembler_Fail)
530
0
    return MCDisassembler_Fail;
531
0
  if (DecodeGPRRegisterClass(Inst, Rs1, Address, Decoder) ==
532
0
      MCDisassembler_Fail)
533
0
    return MCDisassembler_Fail;
534
0
  DecodeStatus Result =
535
0
    CONCAT(decodeUImmOperand, 2)(Inst, UImm2, Address, Decoder);
536
0
  (void)Result;
537
0
  CS_ASSERT(Result == MCDisassembler_Success && "Invalid immediate");
538
539
  // Disassemble the final operand which is implicit.
540
0
  unsigned Opcode = MCInst_getOpcode(Inst);
541
0
  bool IsWordOp = (Opcode == RISCV_TH_LWD || Opcode == RISCV_TH_LWUD ||
542
0
       Opcode == RISCV_TH_SWD);
543
0
  if (IsWordOp)
544
0
    MCOperand_CreateImm0(Inst, (3));
545
0
  else
546
0
    MCOperand_CreateImm0(Inst, (4));
547
548
0
  return MCDisassembler_Success;
549
0
}
550
551
static DecodeStatus decodeZcmpRlist(MCInst *Inst, unsigned Imm,
552
            uint64_t Address, const void *Decoder)
553
0
{
554
0
  if (Imm <= 3)
555
0
    return MCDisassembler_Fail;
556
0
  MCOperand_CreateImm0(Inst, (Imm));
557
0
  return MCDisassembler_Success;
558
0
}
559
560
static DecodeStatus decodeRegReg(MCInst *Inst, uint32_t Insn, uint64_t Address,
561
         const void *Decoder)
562
58
{
563
58
  uint32_t Rs1 = fieldFromInstruction_4(Insn, 0, 5);
564
58
  uint32_t Rs2 = fieldFromInstruction_4(Insn, 5, 5);
565
58
  if (DecodeGPRRegisterClass(Inst, Rs1, Address, Decoder) ==
566
58
      MCDisassembler_Fail)
567
0
    return MCDisassembler_Fail;
568
58
  if (DecodeGPRRegisterClass(Inst, Rs2, Address, Decoder) ==
569
58
      MCDisassembler_Fail)
570
0
    return MCDisassembler_Fail;
571
58
  return MCDisassembler_Success;
572
58
}
573
574
static DecodeStatus decodeZcmpSpimm(MCInst *Inst, unsigned Imm,
575
            uint64_t Address, const void *Decoder)
576
0
{
577
0
  MCOperand_CreateImm0(Inst, (Imm));
578
0
  return MCDisassembler_Success;
579
0
}
580
581
// Add implied SP operand for C.*SP compressed instructions. The SP operand
582
// isn't explicitly encoded in the instruction.
583
void addSPOperands(MCInst *MI)
584
28.6k
{
585
28.6k
  const MCInstrDesc *MCID = MCInstrDesc_get(MCInst_getOpcode(MI),
586
28.6k
              RISCVDescs.Insts,
587
28.6k
              ARR_SIZE(RISCVDescs.Insts));
588
28.6k
  MCOperand SPReg;
589
28.6k
  SPReg.MachineOperandType = kRegister;
590
28.6k
  SPReg.Kind = kRegister;
591
28.6k
  SPReg.RegVal = RISCV_X2;
592
95.2k
  for (unsigned i = 0; i < MCID->NumOperands; i++)
593
66.5k
    if (MCID->OpInfo[i].RegClass == RISCV_SPRegClassID)
594
6.33k
      MCInst_insert0(MI, i, &SPReg);
595
28.6k
}
596
597
DecodeStatus RISCV_getInstruction(MCInst *MI, uint16_t *Size,
598
          const uint8_t *Bytes, size_t BytesLen,
599
          uint64_t Address, SStream *CS)
600
47.2k
{
601
  // TODO: This will need modification when supporting instruction set
602
  // extensions with instructions > 32-bits (up to 176 bits wide).
603
47.2k
  uint32_t Insn;
604
47.2k
  DecodeStatus Result;
605
606
47.2k
#define TRY_TO_DECODE_WITH_ADDITIONAL_OPERATION( \
607
47.2k
  width, FEATURE_CHECKS, DECODER_TABLE, DESC, ADDITIONAL_OPERATION) \
608
641k
  do { \
609
696k
    if (FEATURE_CHECKS) { \
610
165k
      Result = decodeInstruction_##width( \
611
165k
        DECODER_TABLE, MI, Insn, Address, NULL); \
612
165k
      if (Result != MCDisassembler_Fail) { \
613
46.5k
        ADDITIONAL_OPERATION; \
614
46.5k
        return Result; \
615
46.5k
      } \
616
165k
    } \
617
641k
  } while (false)
618
47.2k
#define TRY_TO_DECODE_AND_ADD_SP(width, FEATURE_CHECKS, DECODER_TABLE, DESC) \
619
57.1k
  TRY_TO_DECODE_WITH_ADDITIONAL_OPERATION( \
620
57.1k
    width, FEATURE_CHECKS, DECODER_TABLE, DESC, addSPOperands(MI))
621
47.2k
#define TRY_TO_DECODE(width, FEATURE_CHECKS, DECODER_TABLE, DESC) \
622
584k
  TRY_TO_DECODE_WITH_ADDITIONAL_OPERATION( \
623
584k
    width, FEATURE_CHECKS, DECODER_TABLE, DESC, (void)NULL)
624
47.2k
#define TRY_TO_DECODE_FEATURE(width, FEATURE, DECODER_TABLE, DESC) \
625
532k
  TRY_TO_DECODE(width, RISCV_getFeatureBits(MI->csh->mode, FEATURE), \
626
532k
          DECODER_TABLE, DESC)
627
628
  // It's a 32 bit instruction if bit 0 and 1 are 1.
629
47.2k
  if ((Bytes[0] & 0x3) == 0x3) {
630
18.2k
    if (BytesLen < 4) {
631
153
      *Size = 0;
632
153
      return MCDisassembler_Fail;
633
153
    }
634
18.1k
    *Size = 4;
635
636
18.1k
    Insn = readBytes32(MI, Bytes);
637
638
18.1k
    TRY_TO_DECODE(4,
639
18.1k
            RISCV_getFeatureBits(MI->csh->mode,
640
18.1k
               RISCV_FeatureStdExtZdinx) &&
641
18.1k
              !RISCV_getFeatureBits(MI->csh->mode,
642
18.1k
                  RISCV_Feature64Bit),
643
18.1k
            DecoderTableRV32Zdinx32,
644
18.1k
            "RV32Zdinx table (Double in Integer and rv32)");
645
18.1k
    TRY_TO_DECODE(4,
646
18.0k
            RISCV_getFeatureBits(MI->csh->mode,
647
18.0k
               RISCV_FeatureStdExtZacas) &&
648
18.0k
              !RISCV_getFeatureBits(MI->csh->mode,
649
18.0k
                  RISCV_Feature64Bit),
650
18.0k
            DecoderTableRV32Zacas32,
651
18.0k
            "RV32Zacas table (Compare-And-Swap and rv32)");
652
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureStdExtZfinx,
653
18.0k
              DecoderTableRVZfinx32,
654
18.0k
              "RVZfinx table (Float in Integer)");
655
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXVentanaCondOps,
656
18.0k
              DecoderTableXVentana32,
657
18.0k
              "Ventana custom opcode table");
658
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadBa,
659
18.0k
              DecoderTableXTHeadBa32,
660
18.0k
              "XTHeadBa custom opcode table");
661
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadBb,
662
18.0k
              DecoderTableXTHeadBb32,
663
18.0k
              "XTHeadBb custom opcode table");
664
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadBs,
665
18.0k
              DecoderTableXTHeadBs32,
666
18.0k
              "XTHeadBs custom opcode table");
667
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadCondMov,
668
18.0k
              DecoderTableXTHeadCondMov32,
669
18.0k
              "XTHeadCondMov custom opcode table");
670
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadCmo,
671
18.0k
              DecoderTableXTHeadCmo32,
672
18.0k
              "XTHeadCmo custom opcode table");
673
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadFMemIdx,
674
18.0k
              DecoderTableXTHeadFMemIdx32,
675
18.0k
              "XTHeadFMemIdx custom opcode table");
676
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadMac,
677
18.0k
              DecoderTableXTHeadMac32,
678
18.0k
              "XTHeadMac custom opcode table");
679
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadMemIdx,
680
18.0k
              DecoderTableXTHeadMemIdx32,
681
18.0k
              "XTHeadMemIdx custom opcode table");
682
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadMemPair,
683
18.0k
              DecoderTableXTHeadMemPair32,
684
18.0k
              "XTHeadMemPair custom opcode table");
685
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadSync,
686
18.0k
              DecoderTableXTHeadSync32,
687
18.0k
              "XTHeadSync custom opcode table");
688
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXTHeadVdot,
689
18.0k
              DecoderTableXTHeadVdot32,
690
18.0k
              "XTHeadVdot custom opcode table");
691
18.0k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXSfvcp,
692
18.0k
              DecoderTableXSfvcp32,
693
18.0k
              "SiFive VCIX custom opcode table");
694
18.0k
    TRY_TO_DECODE_FEATURE(
695
18.0k
      4, RISCV_FeatureVendorXSfvqmaccdod,
696
18.0k
      DecoderTableXSfvqmaccdod32,
697
18.0k
      "SiFive Matrix Multiplication (2x8 and 8x2) Instruction opcode table");
698
18.0k
    TRY_TO_DECODE_FEATURE(
699
18.0k
      4, RISCV_FeatureVendorXSfvqmaccqoq,
700
18.0k
      DecoderTableXSfvqmaccqoq32,
701
18.0k
      "SiFive Matrix Multiplication (4x8 and 8x4) Instruction opcode table");
702
18.0k
    TRY_TO_DECODE_FEATURE(
703
18.0k
      4, RISCV_FeatureVendorXSfvfwmaccqqq,
704
18.0k
      DecoderTableXSfvfwmaccqqq32,
705
18.0k
      "SiFive Matrix Multiplication Instruction opcode table");
706
18.0k
    TRY_TO_DECODE_FEATURE(
707
18.0k
      4, RISCV_FeatureVendorXSfvfnrclipxfqf,
708
18.0k
      DecoderTableXSfvfnrclipxfqf32,
709
18.0k
      "SiFive FP32-to-int8 Ranged Clip Instructions opcode table");
710
18.0k
    TRY_TO_DECODE_FEATURE(
711
17.8k
      4, RISCV_FeatureVendorXCVbitmanip,
712
17.8k
      DecoderTableXCVbitmanip32,
713
17.8k
      "CORE-V Bit Manipulation custom opcode table");
714
17.8k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCVelw,
715
17.8k
              DecoderTableXCVelw32,
716
17.8k
              "CORE-V Event load custom opcode table");
717
17.8k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCVmac,
718
17.5k
              DecoderTableXCVmac32,
719
17.5k
              "CORE-V MAC custom opcode table");
720
17.5k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCVmem,
721
17.1k
              DecoderTableXCVmem32,
722
17.1k
              "CORE-V MEM custom opcode table");
723
17.1k
    TRY_TO_DECODE_FEATURE(4, RISCV_FeatureVendorXCValu,
724
17.1k
              DecoderTableXCValu32,
725
17.1k
              "CORE-V ALU custom opcode table");
726
17.1k
    TRY_TO_DECODE_FEATURE(
727
16.2k
      4, RISCV_FeatureVendorXCVsimd, DecoderTableXCVsimd32,
728
16.2k
      "CORE-V SIMD extensions custom opcode table");
729
16.2k
    TRY_TO_DECODE_FEATURE(
730
16.2k
      4, RISCV_FeatureVendorXCVbi, DecoderTableXCVbi32,
731
16.2k
      "CORE-V Immediate Branching custom opcode table");
732
16.2k
    TRY_TO_DECODE(4, true, DecoderTable32, "RISCV32 table");
733
734
200
    return MCDisassembler_Fail;
735
16.2k
  }
736
737
29.0k
  if (BytesLen < 2) {
738
176
    *Size = 0;
739
176
    return MCDisassembler_Fail;
740
176
  }
741
28.8k
  *Size = 2;
742
743
28.8k
  Insn = readBytes16(MI, Bytes);
744
28.8k
  TRY_TO_DECODE_AND_ADD_SP(
745
28.2k
    2, !RISCV_getFeatureBits(MI->csh->mode, RISCV_Feature64Bit),
746
28.2k
    DecoderTableRISCV32Only_16,
747
28.2k
    "RISCV32Only_16 table (16-bit Instruction)");
748
28.2k
  TRY_TO_DECODE_FEATURE(2, RISCV_FeatureStdExtZicfiss,
749
28.2k
            DecoderTableZicfiss16,
750
28.2k
            "RVZicfiss table (Shadow Stack)");
751
28.2k
  TRY_TO_DECODE_FEATURE(2, RISCV_FeatureStdExtZcmt, DecoderTableRVZcmt16,
752
28.2k
            "Zcmt table (16-bit Table Jump Instructions)");
753
28.2k
  TRY_TO_DECODE_FEATURE(
754
28.2k
    2, RISCV_FeatureStdExtZcmp, DecoderTableRVZcmp16,
755
28.2k
    "Zcmp table (16-bit Push/Pop & Double Move Instructions)");
756
28.2k
  TRY_TO_DECODE_AND_ADD_SP(2, true, DecoderTable16,
757
192
         "RISCV_C table (16-bit Instruction)");
758
759
192
  return MCDisassembler_Fail;
760
28.2k
}
761
762
bool RISCV_LLVM_getInstruction(csh handle, const uint8_t *Bytes, size_t ByteLen,
763
             MCInst *MI, uint16_t *Size, uint64_t Address,
764
             void *Info)
765
47.2k
{
766
47.2k
  RISCV_init_cs_detail(MI);
767
47.2k
  MI->MRI = (MCRegisterInfo *)Info;
768
47.2k
  DecodeStatus ret =
769
47.2k
    RISCV_getInstruction(MI, Size, Bytes, ByteLen, Address, NULL);
770
771
47.2k
  MCInst_handleWriteback(MI, RISCVDescs.Insts,
772
47.2k
             ARR_SIZE(RISCVDescs.Insts));
773
774
47.2k
  return ret != MCDisassembler_Fail;
775
47.2k
}