Fails to disassemble MIPS32 LE jr instructions
See original GitHub issueBug Description I’ve noticed that Ghidra is having issues disassembling MIPS32 little-endian jr instructions. I’ve tried disassembling the code sections in Disassembled View by pressing the d key, right-click + Disassemble, right-click + Disassemble (Restricted), right-click + Disassemble (Static), right-click + Disassemble - MIPS, and right-click + Disassemble - MicroMips with no success.
To Reproduce Try to disassemble: 0800e003 - jr $ra 08002003 - jr $t9
Expected behavior
Disassemble 0800e003 to jr $ra
and 08002003 to jr $t9
.
Environment:
- OS: Ubuntu 18.04.2 LTS
- Java Version: 11.0.2
- Ghidra Version: 9.0
Additional notes
This is a high impact bug because it frequently breaks the Function Graph’s control flow and results in the decompiler producing functions consisting of only halt_baddata();
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Why doesn't jr instruction (MIPS) do what I expect it to do in my ...
I can't tell why it causes the program to fail. I thought that the jr instruction will go to the address inside $8...
Read more >IDA Pro, How to forcefully disassemble "mips 32" instead of ...
Two options: at the .set mips16 line, press Alt-G , choose mips16 and set the value to 0. ... Press Ctrl-G to display...
Read more >MIPS J Type Instruction Format Addressing - YouTube
In this video I go over how J type instructions (j, jal) are used to construct a target memory address to jump to.The...
Read more >Ground Truth for Binary Disassembly is Not Easy - USENIX
In this paper, we focus on the above concern about ground truth for binary disassembly. We start with a taxonomy of the approaches...
Read more >CS61C Summer 2013 Project 1: MIPS Instruction Set Emulator
Your disassembly code for lui should print the immediate field in lowercase hexadecimal, with no leading 0's and with a 0x prepended. Make...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Putting a branch instruction in the delay slot is unpredictable behavior. There is code in the mips processor spec to not decode a branch in the delay slot. In the R6 spec it will be an invalid instruction exception.
I suppose if you set both ra and t9 to the same address you would get predictable behavior and end up at the correct address.
The processor could be changed to allow the instruction patterns were it to be encountered with a warning of unpredictable results, and an arbitrary branch to the first jump address. Is that the behavior your binary is exhibiting?
Closed since I believe this has been suitably addressed.