Skip to content

Commit

Permalink
Fix operands of RFED instructions
Browse files Browse the repository at this point in the history
They have now memory operand and
the writeback flag is set accordingly.
  • Loading branch information
Rot127 committed Nov 25, 2024
1 parent 80e9a45 commit b5a6457
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
14 changes: 14 additions & 0 deletions arch/ARM/ARMMapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,20 @@ static void ARM_add_not_defined_ops(MCInst *MI)
}
break;
}
case ARM_RFEDA_UPD:
case ARM_RFEDB_UPD:
case ARM_RFEIA_UPD:
case ARM_RFEIB_UPD:
get_detail(MI)->writeback = true;
// fallthrough
case ARM_RFEDA:
case ARM_RFEDB:
case ARM_RFEIA:
case ARM_RFEIB: {
arm_reg base_reg = ARM_get_detail_op(MI, -1)->reg;
ARM_get_detail_op(MI, -1)->type = ARM_OP_MEM;
ARM_get_detail_op(MI, -1)->mem.base = base_reg;
}
}
}

Expand Down
40 changes: 40 additions & 0 deletions tests/details/arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2785,3 +2785,43 @@ test_cases:
writeback: 1
regs_read: [ cpsr, r4 ]
regs_write: [ r4 ]
-
input:
bytes: [ 0x00, 0x0a, 0x33, 0xf9 ]
arch: "CS_ARCH_ARM"
options: [ CS_OPT_DETAIL ]
address: 0x0
expected:
insns:
-
asm_text: "rfedb r3!"
details:
arm:
operands:
-
type: ARM_OP_MEM
mem_base: r3
access: CS_AC_READ
writeback: 1
regs_read: [ r3 ]
regs_write: [ r3 ]
-
input:
bytes: [ 0x00, 0x0a, 0x13, 0xf9 ]
arch: "CS_ARCH_ARM"
options: [ CS_OPT_DETAIL ]
address: 0x0
expected:
insns:
-
asm_text: "rfedb r3"
details:
arm:
operands:
-
type: ARM_OP_MEM
mem_base: r3
access: CS_AC_READ
writeback: -1
regs_read: [ r3 ]
regs_write: [ ]

0 comments on commit b5a6457

Please sign in to comment.