Skip to content

Architecture plugin delay slot breaks branching logic #1749

Answered by mothran
mothran asked this question in Architectures
Discussion options

You must be logged in to vote

I get to answer my own question!

So the issue is that the architecture plugin itself has to handle the lifting reordering. The binaryninja arch-mips plugin is a great example of how this works:

First double the max instruction width, example:
https://github.com/Vector35/arch-mips/blob/master/arch_mips.cpp#L381

Then, detect the branch delay in the lifting code and lift the delay slot first, then lift the branch:
https://github.com/Vector35/arch-mips/blob/master/arch_mips.cpp#L457

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@psifertex
Comment options

Answer selected by psifertex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1749 on October 07, 2020 19:28.