Fix pimm/cimm opex printing in ARM instructions (#1730)

* Fix pimm/cimm opex printing in ARM instructions
* Add test for opex cimm/pimm in ARM
This commit is contained in:
Riccardo Schirone 2021-09-23 09:39:14 +02:00
parent 392b95b1df
commit 120235ac68
2 changed files with 19 additions and 2 deletions

View file

@ -265,9 +265,11 @@ static void opex(RzStrBuf *buf, csh handle, cs_insn *insn) {
pj_kd(pj, "value", op->fp);
break;
case ARM_OP_CIMM:
pj_ks(pj, "type", "cimm");
pj_ki(pj, "value", op->imm);
break;
case ARM_OP_PIMM:
pj_ks(pj, "type", "cimm");
pj_ks(pj, "type", "pimm");
pj_ki(pj, "value", op->imm);
break;
case ARM_OP_SETEND:
@ -3494,7 +3496,9 @@ jmp $$ + 4 + ( [delta] * 2 )
case ARM_INS_LDRT:
op->cycles = 4;
// 0x000082a8 28301be5 ldr r3, [fp, -0x28]
op->scale = INSOP(1).mem.scale << LSHIFT(1);
if (INSOP(1).mem.scale != -1) {
op->scale = INSOP(1).mem.scale << LSHIFT(1);
}
op->ireg = cs_reg_name(handle, REGBASE(1));
op->disp = MEMDISP(1);
if (REGID(0) == ARM_REG_PC) {

View file

@ -94,3 +94,16 @@ stackptr: 8
]
EOF
RUN
NAME=pimm/cimm
FILE==
CMDS=<<EOF
e asm.arch=arm
e asm.bits=32
wx 2f6c642d
aoj~{opex}
EOF
EXPECT=<<EOF
{"opcode":"stclhs p12, c6, [r4, -0xbc]!","disasm":"stclhs p12, c6, [r4, -0xbc]!","pseudo":"asm(\"stclhs p12, c6, [r4, -0xbc]!\")","mnemonic":"stclhs","mask":"ffffffff","esil":"cf,?{,,}","sign":false,"prefix":0,"id":191,"opex":{"operands":[{"type":"pimm","value":12},{"type":"cimm","value":6},{"type":"mem","base":"r4","scale":1,"disp":-188}],"writeback":true,"cc":"hs"},"addr":0,"bytes":"2f6c642d","size":4,"type":"null","esilcost":0,"scale":0,"refptr":0,"cycles":1,"failcycles":0,"delay":0,"stackptr":0,"family":"cpu"}
EOF
RUN