Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM jump instuctions #1197

Closed
valour01 opened this issue Jul 4, 2018 · 1 comment · Fixed by #1949
Closed

ARM jump instuctions #1197

valour01 opened this issue Jul 4, 2018 · 1 comment · Fixed by #1949

Comments

@valour01
Copy link

valour01 commented Jul 4, 2018

Hi. I am using capstone to disassemble arm based binaries.
I noticed that I can use CS_GRP_JUMP to check whether a instruction is a jump instruction. Where I can get all the instructions name that belong to this group. I am sorry I didn't find the related code. Besides, does CS_GRP_JUMP consider the case like ldr pc, [addr]

Furthermore, is there an API to check whether a jump instruction is direct jump or indirect jump. If it is a direct jump. Is there an API to get the jump target. Many Thanks.

@abenkhadra
Copy link
Contributor

abenkhadra commented Jul 5, 2018

Where I can get all the instructions name that belong to this group.

you need to look into the mapping files. Here for master and here for next. Not all mappings are explicitly stated there though.

does CS_GRP_JUMP consider the case like ldr pc, [addr]

No. the mappings identify instructions that are definitely jumps based on the instruction id rather than the affected operands . That is, ARM_INS_B is always a jump instruction regardless of its operands. In contrast, ldr might be a jump depending on its operands. Therefore, you need to examine the operands to see if pc is modified.

is there an API to check whether a jump instruction is direct jump or indirect jump

You need to check the operands also here. If the instruction is branching based on an immediate, then it is a direct branch. Otherwise, it is an indirect branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants