mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-27 15:30:33 +00:00
arm: fix mapping of ARM_SUBri (issue #1456)
This commit is contained in:
parent
25b6704978
commit
6afd3aca6f
@ -267,24 +267,50 @@ const char *ARM_reg_name2(csh handle, unsigned int reg)
|
||||
}
|
||||
|
||||
static const insn_map insns[] = {
|
||||
// dummy item
|
||||
{
|
||||
0, 0,
|
||||
#ifndef CAPSTONE_DIET
|
||||
{ 0 }, { 0 }, { 0 }, 0, 0
|
||||
#endif
|
||||
},
|
||||
|
||||
#include "ARMMappingInsn.inc"
|
||||
};
|
||||
|
||||
// look for @id in @insns
|
||||
// return -1 if not found
|
||||
static unsigned int find_insn(unsigned int id)
|
||||
{
|
||||
// binary searching since the IDs are sorted in order
|
||||
unsigned int left, right, m;
|
||||
unsigned int max = ARR_SIZE(insns);
|
||||
|
||||
right = max - 1;
|
||||
|
||||
if (id < insns[0].id || id > insns[right].id)
|
||||
// not found
|
||||
return -1;
|
||||
|
||||
left = 0;
|
||||
|
||||
while(left <= right) {
|
||||
m = (left + right) / 2;
|
||||
if (id == insns[m].id) {
|
||||
return m;
|
||||
}
|
||||
|
||||
if (id < insns[m].id)
|
||||
right = m - 1;
|
||||
else
|
||||
left = m + 1;
|
||||
}
|
||||
|
||||
// not found
|
||||
// printf("NOT FOUNDDDDDDDDDDDDDDD id = %u\n", id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ARM_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
|
||||
{
|
||||
int i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
|
||||
//printf(">> id = %u\n", id);
|
||||
unsigned int i = find_insn(id);
|
||||
if (i != 0) {
|
||||
insn->id = insns[i].mapid;
|
||||
|
||||
// printf("id = %u, mapid = %u\n", id, insn->id);
|
||||
|
||||
if (h->detail) {
|
||||
#ifndef CAPSTONE_DIET
|
||||
cs_struct handle;
|
||||
|
@ -4183,7 +4183,7 @@
|
||||
},
|
||||
|
||||
{
|
||||
ARM_SUBri, ARM_INS_ADD,
|
||||
ARM_SUBri, ARM_INS_SUB,
|
||||
#ifndef CAPSTONE_DIET
|
||||
{ 0 }, { 0 }, { ARM_GRP_ARM, 0 }, 0, 0
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user