-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
The regs_access() function returns 'sp' as a read register for the bl
instruction.
Below is a small script that reproduces the issue between version 4.0.2 and the most recent commit as of this comment.
#! /usr/bin/env python3
# cs_test.py
from capstone import *
try:
md = Cs(CS_ARCH_ARM64, CS_MODE_ARM | CS_MODE_LITTLE_ENDIAN)
except:
md = Cs(CS_ARCH_AARCH64, CS_MODE_ARM | CS_MODE_LITTLE_ENDIAN)
md.detail = True
instruction_bytes = b"\xec\x6a\x01\x95"
inst = list(md.disasm(instruction_bytes, offset=0x0, count=1))[0]
print(inst)
regs_read, regs_written = inst.regs_access()
regs_read = [inst.reg_name(r) for r in regs_read]
regs_written = [inst.reg_name(r) for r in regs_written]
print(regs_read, regs_written)
4.0.2:
$ ./test.py
<CsInsn 0x0 [ec6a0195]: bl #0x405abb0>
[] ['x30']
next branch b9c260e:
$ ./test.py
<CsInsn 0x0 [ec6a0195]: bl 0x405abb0>
['sp'] ['x30']
Metadata
Metadata
Assignees
Labels
No labels