4 #ifdef CAPSTONE_HAS_TMS320C64X
8 #ifndef _CRT_SECURE_NO_WARNINGS
9 #define _CRT_SECURE_NO_WARNINGS
14 #pragma warning(disable:28719)
21 #include "../../MCInst.h"
22 #include "../../utils.h"
23 #include "../../SStream.h"
24 #include "../../MCRegisterInfo.h"
25 #include "../../MathExtras.h"
30 static char *getRegisterName(
unsigned RegNo);
32 static void printMemOperand(
MCInst *MI,
unsigned OpNo,
SStream *
O);
33 static void printMemOperand2(
MCInst *MI,
unsigned OpNo,
SStream *
O);
40 unsigned int unit = 0;
45 tms320c64x = &mci->
flat_insn->detail->tms320c64x;
47 for (
i = 0;
i < insn->detail->groups_count;
i++) {
48 switch(insn->detail->groups[
i]) {
74 p = strchr(insn_asm,
'\t');
79 if ((
p !=
NULL) && (((p2 = strchr(
p,
'[')) !=
NULL) || ((p2 = strchr(
p,
'(')) !=
NULL))) {
80 while ((p2 >
p) && ((*p2 !=
'a') && (*p2 !=
'b')))
83 strcpy(insn_asm,
"Invalid!");
117 strcpy(insn_asm, ss.
buffer);
121 #define PRINT_ALIAS_INSTR
124 #define GET_INSTRINFO_ENUM
153 MI->
flat_insn->detail->tms320c64x.op_count++;
172 MI->
flat_insn->detail->tms320c64x.operands[MI->
flat_insn->detail->tms320c64x.op_count].imm = Imm;
173 MI->
flat_insn->detail->tms320c64x.op_count++;
178 static void printMemOperand(
MCInst *MI,
unsigned OpNo,
SStream *
O)
186 scaled = (Val >> 19) & 1;
187 base = (Val >> 12) & 0x7f;
188 offset = (Val >> 5) & 0x7f;
189 mode = (Val >> 1) & 0xf;
240 tms320c64x = &MI->
flat_insn->detail->tms320c64x;
313 static void printMemOperand2(
MCInst *MI,
unsigned OpNo,
SStream *
O)
321 basereg = Val & 0x7f;
322 offset = (Val >> 7) & 0x7fff;
326 tms320c64x = &MI->
flat_insn->detail->tms320c64x;
348 tms320c64x = &MI->
flat_insn->detail->tms320c64x;
363 case TMS320C64x_ADD_d2_rir:
365 case TMS320C64x_ADD_l1_irr:
366 case TMS320C64x_ADD_l1_ipp:
368 case TMS320C64x_ADD_s1_irr:
380 printOperand(MI, 1,
O);
382 printOperand(MI, 2,
O);
384 printOperand(MI, 0,
O);
392 case TMS320C64x_ADD_d1_rir:
394 case TMS320C64x_OR_d2_rir:
396 case TMS320C64x_ADD_l1_irr:
397 case TMS320C64x_ADD_l1_ipp:
399 case TMS320C64x_OR_l1_irr:
401 case TMS320C64x_ADD_s1_irr:
403 case TMS320C64x_OR_s1_irr:
414 printOperand(MI, 1,
O);
416 printOperand(MI, 0,
O);
424 case TMS320C64x_XOR_d2_rir:
426 case TMS320C64x_XOR_l1_irr:
428 case TMS320C64x_XOR_s1_irr:
439 printOperand(MI, 1,
O);
441 printOperand(MI, 0,
O);
449 case TMS320C64x_MVK_d1_rr:
451 case TMS320C64x_MVK_l2_ir:
461 printOperand(MI, 0,
O);
469 case TMS320C64x_SUB_l1_rrp_x1:
471 case TMS320C64x_SUB_s1_rrr:
482 printOperand(MI, 0,
O);
490 case TMS320C64x_SUB_l1_irr:
491 case TMS320C64x_SUB_l1_ipp:
493 case TMS320C64x_SUB_s1_irr:
504 printOperand(MI, 1,
O);
506 printOperand(MI, 0,
O);
514 case TMS320C64x_PACKLH2_l1_rrr_x2:
516 case TMS320C64x_PACKLH2_s1_rrr:
527 printOperand(MI, 1,
O);
529 printOperand(MI, 0,
O);
538 case TMS320C64x_NOP_n:
568 if (!printAliasInstruction(MI,
O, Info))
569 printInstruction(MI,
O, Info);
unsigned MCInst_getOpcode(const MCInst *inst)
unsigned MCInst_getNumOperands(const MCInst *inst)
MCOperand * MCInst_getOperand(MCInst *inst, unsigned i)
void MCOperand_setImm(MCOperand *op, int64_t Val)
bool MCOperand_isReg(const MCOperand *op)
void MCInst_setOpcodePub(MCInst *inst, unsigned Op)
int64_t MCOperand_getImm(MCOperand *op)
unsigned MCOperand_getReg(const MCOperand *op)
getReg - Returns the register number.
bool MCOperand_isImm(const MCOperand *op)
void SStream_Init(SStream *ss)
void SStream_concat(SStream *ss, const char *fmt,...)
void SStream_concat0(SStream *ss, const char *s)
void TMS320C64x_post_printer(csh ud, cs_insn *insn, char *insn_asm, MCInst *mci)
void TMS320C64x_printInst(MCInst *MI, SStream *O, void *Info)
CAPSTONE_EXPORT const char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
tms320c64x_op_mem mem
base/disp value for MEM operand
tms320c64x_op_type type
operand type
unsigned int reg
register value for REG operand or first register for REGPAIR operand
cs_tms320c64x_op operands[8]
operands for this instruction.
struct cs_tms320c64x::@364 funit
struct cs_tms320c64x::@363 condition
unsigned int disp
displacement/offset value
unsigned int base
base register
unsigned int scaled
offset scaled
unsigned int modify
modification
unsigned int direction
direction
unsigned int disptype
displacement type
unsigned int unit
unit of base and offset register
@ TMS320C64X_GRP_FUNIT_NO
@ TMS320C64X_MEM_DISP_CONSTANT
@ TMS320C64X_MEM_DISP_REGISTER
@ TMS320C64X_MEM_MOD_POST
@ TMS320C64X_OP_REG
= CS_OP_REG (Register operand).
@ TMS320C64X_OP_REGPAIR
Register pair for double word ops.
@ TMS320C64X_OP_IMM
= CS_OP_IMM (Immediate operand).
@ TMS320C64X_OP_MEM
= CS_OP_MEM (Memory operand).