Open
Description
Would it be possible to add support for different <amode>
(DA
: Decrement After, DB
: Decrement Before, IA
: Increment After and IB
: Increment Before) in instructions such as ldm
(or stm
)? These seem currently not being supported (see example below).
Example:
#!/usr/bin/env python3
## -*- coding: utf-8 -*-
from triton import ARCH, EXCEPTION, Instruction, MemoryAccess, MODE, TritonContext
function = {
0x8000: b"\x06\x00\x90\xe8", # ldm r0, {r1, r2}
0x8004: b"\x06\x00\x10\xe9", # ldmdb r0, {r1, r2}
}
ctx = TritonContext(ARCH.ARM32)
ctx.setMode(MODE.ALIGNED_MEMORY, True)
ctx.setThumb(False)
ctx.setConcreteRegisterValue(ctx.registers.r0, 0x1000)
ctx.setConcreteMemoryValue(MemoryAccess(0x0ff8, 4), 0x0ff8)
ctx.setConcreteMemoryValue(MemoryAccess(0x0ffc, 4), 0x0ffc)
ctx.setConcreteMemoryValue(MemoryAccess(0x1000, 4), 0x1000)
ctx.setConcreteMemoryValue(MemoryAccess(0x1004, 4), 0x1004)
pc = 0x8000
while pc in function:
inst = Instruction(pc, function[pc])
e = ctx.processing(inst)
print(inst)
if e != EXCEPTION.NO_FAULT:
print(f"\tException = {e:d}")
break
r0 = ctx.getConcreteRegisterValue(ctx.registers.r0)
r1 = ctx.getConcreteRegisterValue(ctx.registers.r1)
r2 = ctx.getConcreteRegisterValue(ctx.registers.r2)
print(f"\tr0 = 0x{r0:x}")
print(f"\tr1 = 0x{r1:x}")
print(f"\tr2 = 0x{r2:x}")
pc = ctx.getConcreteRegisterValue(ctx.registers.pc)
Output:
0x8000: ldm r0, {r1, r2}
r0 = 0x1000
r1 = 0x1000
r2 = 0x1004
0x8004: ldmdb r0, {r1, r2}
Exception = 3