int tms320_c55x_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { const char * str = engine.syntax; op->delay = 0; op->size = tms320_dasm(&engine, buf, len); op->type = R_ANAL_OP_TYPE_NULL; str = strstr(str, "||") ? str + 3 : str; if (match(str, "B ")) { op->type = R_ANAL_OP_TYPE_JMP; if (match(str, "B AC")) op->type = R_ANAL_OP_TYPE_UJMP; } else if (match(str, "BCC ") || match(str, "BCCU ")) { op->type = R_ANAL_OP_TYPE_CJMP; } else if (match(str, "CALL ")) { op->type = R_ANAL_OP_TYPE_CALL; if (match(str, "CALL AC")) op->type = R_ANAL_OP_TYPE_UCALL; } else if (match(str, "CALLCC ")) { op->type = R_ANAL_OP_TYPE_CCALL; } else if (match(str, "RET")) { op->type = R_ANAL_OP_TYPE_RET; if (match(str, "RETCC")) op->type = R_ANAL_OP_TYPE_CRET; } else if (match(str, "MOV ")) { op->type = R_ANAL_OP_TYPE_MOV; } else if (match(str, "PSHBOTH ")) { op->type = R_ANAL_OP_TYPE_UPUSH; } else if (match(str, "PSH ")) { op->type = R_ANAL_OP_TYPE_PUSH; } else if (match(str, "POPBOTH ") || match(str, "POP ")) { op->type = R_ANAL_OP_TYPE_POP; } else if (match(str, "CMP ")) { op->type = R_ANAL_OP_TYPE_CMP; } else if (match(str, "CMPAND ")) { op->type = R_ANAL_OP_TYPE_ACMP; } else if (match(str, "NOP")) { op->type = R_ANAL_OP_TYPE_NOP; } else if (match(str, "INTR ")) { op->type = R_ANAL_OP_TYPE_SWI; } else if (match(str, "TRAP ")) { op->type = R_ANAL_OP_TYPE_TRAP; } else if (match(str, "INVALID")) { op->type = R_ANAL_OP_TYPE_UNK; } return op->size; }
static int tms320_disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { if (a->cpu && r_str_casecmp (a->cpu, "c54x") == 0) { tms320_f_set_cpu (&engine, TMS320_F_CPU_C54X); } else if (a->cpu && r_str_casecmp(a->cpu, "c55x+") == 0) { tms320_f_set_cpu (&engine, TMS320_F_CPU_C55X_PLUS); } else if (a->cpu && r_str_casecmp(a->cpu, "c55x") == 0) { tms320_f_set_cpu (&engine, TMS320_F_CPU_C55X); } else { #if CAPSTONE_HAS_TMS320C64X if (a->cpu && !r_str_casecmp (a->cpu, "c64x")) { return tms320c64x_disassemble (a, op, buf, len); } #endif r_asm_op_set_asm (op, "unknown asm.cpu"); return op->size = -1; } op->size = tms320_dasm (&engine, buf, len); r_asm_op_set_asm (op, engine.syntax); return op->size; }