mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-23 21:49:46 +00:00
TMS320C64x instruction names (#1373)
* TMS320C64x instruction names * Fix undefined shift in TMS320C64xDisassembler.c * Adding spaces * remove TMS320C64X_INS_ENDING naming
This commit is contained in:
parent
1d62f11544
commit
bd110ef655
@ -596,7 +596,7 @@ bool TMS320C64x_getInstruction(csh ud, const uint8_t *code, size_t code_len,
|
||||
if(MI->flat_insn->detail)
|
||||
memset(MI->flat_insn->detail, 0, offsetof(cs_detail, tms320c64x)+sizeof(cs_tms320c64x));
|
||||
|
||||
insn = (code[3] << 0) | (code[2] << 8) | (code[1] << 16) | (code[0] << 24);
|
||||
insn = (code[3] << 0) | (code[2] << 8) | (code[1] << 16) | ((uint32_t) code[0] << 24);
|
||||
result = decodeInstruction_4(DecoderTable32, MI, insn, address, info, 0);
|
||||
|
||||
if(result == MCDisassembler_Success) {
|
||||
|
@ -1718,17 +1718,155 @@ void TMS320C64x_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
|
||||
}
|
||||
|
||||
#ifndef CAPSTONE_DIET
|
||||
//grep TMS320C64X_INS include/capstone/tms320c64x.h | awk '{print "{"$1 "\""tolower(substr($1, 16, length($1)-16))"\"""},"}'
|
||||
static name_map insn_name_maps[] = {
|
||||
{ TMS320C64X_INS_INVALID, NULL },
|
||||
|
||||
{ TMS320C64X_INS_ADD, "add" },
|
||||
{ TMS320C64X_INS_NOP, "nop" },
|
||||
{TMS320C64X_INS_INVALID, NULL},
|
||||
{TMS320C64X_INS_ABS, "abs"},
|
||||
{TMS320C64X_INS_ABS2, "abs2"},
|
||||
{TMS320C64X_INS_ADD, "add"},
|
||||
{TMS320C64X_INS_ADD2, "add2"},
|
||||
{TMS320C64X_INS_ADD4, "add4"},
|
||||
{TMS320C64X_INS_ADDAB, "addab"},
|
||||
{TMS320C64X_INS_ADDAD, "addad"},
|
||||
{TMS320C64X_INS_ADDAH, "addah"},
|
||||
{TMS320C64X_INS_ADDAW, "addaw"},
|
||||
{TMS320C64X_INS_ADDK, "addk"},
|
||||
{TMS320C64X_INS_ADDKPC, "addkpc"},
|
||||
{TMS320C64X_INS_ADDU, "addu"},
|
||||
{TMS320C64X_INS_AND, "and"},
|
||||
{TMS320C64X_INS_ANDN, "andn"},
|
||||
{TMS320C64X_INS_AVG2, "avg2"},
|
||||
{TMS320C64X_INS_AVGU4, "avgu4"},
|
||||
{TMS320C64X_INS_B, "b"},
|
||||
{TMS320C64X_INS_BDEC, "bdec"},
|
||||
{TMS320C64X_INS_BITC4, "bitc4"},
|
||||
{TMS320C64X_INS_BNOP, "bnop"},
|
||||
{TMS320C64X_INS_BPOS, "bpos"},
|
||||
{TMS320C64X_INS_CLR, "clr"},
|
||||
{TMS320C64X_INS_CMPEQ, "cmpeq"},
|
||||
{TMS320C64X_INS_CMPEQ2, "cmpeq2"},
|
||||
{TMS320C64X_INS_CMPEQ4, "cmpeq4"},
|
||||
{TMS320C64X_INS_CMPGT, "cmpgt"},
|
||||
{TMS320C64X_INS_CMPGT2, "cmpgt2"},
|
||||
{TMS320C64X_INS_CMPGTU4, "cmpgtu4"},
|
||||
{TMS320C64X_INS_CMPLT, "cmplt"},
|
||||
{TMS320C64X_INS_CMPLTU, "cmpltu"},
|
||||
{TMS320C64X_INS_DEAL, "deal"},
|
||||
{TMS320C64X_INS_DOTP2, "dotp2"},
|
||||
{TMS320C64X_INS_DOTPN2, "dotpn2"},
|
||||
{TMS320C64X_INS_DOTPNRSU2, "dotpnrsu2"},
|
||||
{TMS320C64X_INS_DOTPRSU2, "dotprsu2"},
|
||||
{TMS320C64X_INS_DOTPSU4, "dotpsu4"},
|
||||
{TMS320C64X_INS_DOTPU4, "dotpu4"},
|
||||
{TMS320C64X_INS_EXT, "ext"},
|
||||
{TMS320C64X_INS_EXTU, "extu"},
|
||||
{TMS320C64X_INS_GMPGTU, "gmpgtu"},
|
||||
{TMS320C64X_INS_GMPY4, "gmpy4"},
|
||||
{TMS320C64X_INS_LDB, "ldb"},
|
||||
{TMS320C64X_INS_LDBU, "ldbu"},
|
||||
{TMS320C64X_INS_LDDW, "lddw"},
|
||||
{TMS320C64X_INS_LDH, "ldh"},
|
||||
{TMS320C64X_INS_LDHU, "ldhu"},
|
||||
{TMS320C64X_INS_LDNDW, "ldndw"},
|
||||
{TMS320C64X_INS_LDNW, "ldnw"},
|
||||
{TMS320C64X_INS_LDW, "ldw"},
|
||||
{TMS320C64X_INS_LMBD, "lmbd"},
|
||||
{TMS320C64X_INS_MAX2, "max2"},
|
||||
{TMS320C64X_INS_MAXU4, "maxu4"},
|
||||
{TMS320C64X_INS_MIN2, "min2"},
|
||||
{TMS320C64X_INS_MINU4, "minu4"},
|
||||
{TMS320C64X_INS_MPY, "mpy"},
|
||||
{TMS320C64X_INS_MPY2, "mpy2"},
|
||||
{TMS320C64X_INS_MPYH, "mpyh"},
|
||||
{TMS320C64X_INS_MPYHI, "mpyhi"},
|
||||
{TMS320C64X_INS_MPYHIR, "mpyhir"},
|
||||
{TMS320C64X_INS_MPYHL, "mpyhl"},
|
||||
{TMS320C64X_INS_MPYHLU, "mpyhlu"},
|
||||
{TMS320C64X_INS_MPYHSLU, "mpyhslu"},
|
||||
{TMS320C64X_INS_MPYHSU, "mpyhsu"},
|
||||
{TMS320C64X_INS_MPYHU, "mpyhu"},
|
||||
{TMS320C64X_INS_MPYHULS, "mpyhuls"},
|
||||
{TMS320C64X_INS_MPYHUS, "mpyhus"},
|
||||
{TMS320C64X_INS_MPYLH, "mpylh"},
|
||||
{TMS320C64X_INS_MPYLHU, "mpylhu"},
|
||||
{TMS320C64X_INS_MPYLI, "mpyli"},
|
||||
{TMS320C64X_INS_MPYLIR, "mpylir"},
|
||||
{TMS320C64X_INS_MPYLSHU, "mpylshu"},
|
||||
{TMS320C64X_INS_MPYLUHS, "mpyluhs"},
|
||||
{TMS320C64X_INS_MPYSU, "mpysu"},
|
||||
{TMS320C64X_INS_MPYSU4, "mpysu4"},
|
||||
{TMS320C64X_INS_MPYU, "mpyu"},
|
||||
{TMS320C64X_INS_MPYU4, "mpyu4"},
|
||||
{TMS320C64X_INS_MPYUS, "mpyus"},
|
||||
{TMS320C64X_INS_MVC, "mvc"},
|
||||
{TMS320C64X_INS_MVD, "mvd"},
|
||||
{TMS320C64X_INS_MVK, "mvk"},
|
||||
{TMS320C64X_INS_MVKL, "mvkl"},
|
||||
{TMS320C64X_INS_MVKLH, "mvklh"},
|
||||
{TMS320C64X_INS_NOP, "nop"},
|
||||
{TMS320C64X_INS_NORM, "norm"},
|
||||
{TMS320C64X_INS_OR, "or"},
|
||||
{TMS320C64X_INS_PACK2, "pack2"},
|
||||
{TMS320C64X_INS_PACKH2, "packh2"},
|
||||
{TMS320C64X_INS_PACKH4, "packh4"},
|
||||
{TMS320C64X_INS_PACKHL2, "packhl2"},
|
||||
{TMS320C64X_INS_PACKL4, "packl4"},
|
||||
{TMS320C64X_INS_PACKLH2, "packlh2"},
|
||||
{TMS320C64X_INS_ROTL, "rotl"},
|
||||
{TMS320C64X_INS_SADD, "sadd"},
|
||||
{TMS320C64X_INS_SADD2, "sadd2"},
|
||||
{TMS320C64X_INS_SADDU4, "saddu4"},
|
||||
{TMS320C64X_INS_SADDUS2, "saddus2"},
|
||||
{TMS320C64X_INS_SAT, "sat"},
|
||||
{TMS320C64X_INS_SET, "set"},
|
||||
{TMS320C64X_INS_SHFL, "shfl"},
|
||||
{TMS320C64X_INS_SHL, "shl"},
|
||||
{TMS320C64X_INS_SHLMB, "shlmb"},
|
||||
{TMS320C64X_INS_SHR, "shr"},
|
||||
{TMS320C64X_INS_SHR2, "shr2"},
|
||||
{TMS320C64X_INS_SHRMB, "shrmb"},
|
||||
{TMS320C64X_INS_SHRU, "shru"},
|
||||
{TMS320C64X_INS_SHRU2, "shru2"},
|
||||
{TMS320C64X_INS_SMPY, "smpy"},
|
||||
{TMS320C64X_INS_SMPY2, "smpy2"},
|
||||
{TMS320C64X_INS_SMPYH, "smpyh"},
|
||||
{TMS320C64X_INS_SMPYHL, "smpyhl"},
|
||||
{TMS320C64X_INS_SMPYLH, "smpylh"},
|
||||
{TMS320C64X_INS_SPACK2, "spack2"},
|
||||
{TMS320C64X_INS_SPACKU4, "spacku4"},
|
||||
{TMS320C64X_INS_SSHL, "sshl"},
|
||||
{TMS320C64X_INS_SSHVL, "sshvl"},
|
||||
{TMS320C64X_INS_SSHVR, "sshvr"},
|
||||
{TMS320C64X_INS_SSUB, "ssub"},
|
||||
{TMS320C64X_INS_STB, "stb"},
|
||||
{TMS320C64X_INS_STDW, "stdw"},
|
||||
{TMS320C64X_INS_STH, "sth"},
|
||||
{TMS320C64X_INS_STNDW, "stndw"},
|
||||
{TMS320C64X_INS_STNW, "stnw"},
|
||||
{TMS320C64X_INS_STW, "stw"},
|
||||
{TMS320C64X_INS_SUB, "sub"},
|
||||
{TMS320C64X_INS_SUB2, "sub2"},
|
||||
{TMS320C64X_INS_SUB4, "sub4"},
|
||||
{TMS320C64X_INS_SUBAB, "subab"},
|
||||
{TMS320C64X_INS_SUBABS4, "subabs4"},
|
||||
{TMS320C64X_INS_SUBAH, "subah"},
|
||||
{TMS320C64X_INS_SUBAW, "subaw"},
|
||||
{TMS320C64X_INS_SUBC, "subc"},
|
||||
{TMS320C64X_INS_SUBU, "subu"},
|
||||
{TMS320C64X_INS_SWAP4, "swap4"},
|
||||
{TMS320C64X_INS_UNPKHU4, "unpkhu4"},
|
||||
{TMS320C64X_INS_UNPKLU4, "unpklu4"},
|
||||
{TMS320C64X_INS_XOR, "xor"},
|
||||
{TMS320C64X_INS_XPND2, "xpnd2"},
|
||||
{TMS320C64X_INS_XPND4, "xpnd4"},
|
||||
{TMS320C64X_INS_IDLE, "idle"},
|
||||
{TMS320C64X_INS_MV, "mv"},
|
||||
{TMS320C64X_INS_NEG, "neg"},
|
||||
{TMS320C64X_INS_NOT, "not"},
|
||||
{TMS320C64X_INS_SWAP2, "swap2"},
|
||||
{TMS320C64X_INS_ZERO, "zero"},
|
||||
};
|
||||
|
||||
// special alias insn
|
||||
static name_map alias_insn_names[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
#endif
|
||||
|
||||
const char *TMS320C64x_insn_name(csh handle, unsigned int id)
|
||||
@ -1739,12 +1877,6 @@ const char *TMS320C64x_insn_name(csh handle, unsigned int id)
|
||||
if (id >= TMS320C64X_INS_ENDING)
|
||||
return NULL;
|
||||
|
||||
// handle special alias first
|
||||
for (i = 0; i < ARR_SIZE(alias_insn_names); i++) {
|
||||
if (alias_insn_names[i].id == id)
|
||||
return alias_insn_names[i].name;
|
||||
}
|
||||
|
||||
return insn_name_maps[id].name;
|
||||
#else
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user