esaulenka / ghidra_v850

Ghidra support for Renesas V850 MCUs
MIT License
62 stars 25 forks source link

WIP: Adding support for floating point instructions #1

Closed pd0wm closed 4 years ago

pd0wm commented 4 years ago

This is very much work in progress, but wanted to let you know I'm also working on this.

This is the first time writing a sleigh definition, so let me know if you have any comments/tips!

esaulenka commented 4 years ago

Willem, thanks a lot for your work!

Unfortunately, firmware on which I checked my work (vehicle engine controller), have only few functions with float-point operations. I will try to check your enhancements later.

Some questions:

pd0wm commented 4 years ago

What's your email? I'll send you a few snippets.

Those signed values still need to be removed, they are currently unused. When I added them I thought that was how you signaled that the register needed to be treated as signed, but that is not true.

See page 343 for the explanation of fcond and fcbit for the CMPF.S instruction. fcond is the type of comparison (less than, equal, etc.). You can store the result in any of 8 slots of FPSR. This fcbit determine which result slot to use. After the comparison you use the TRFSR fcbit instruction to move the result from one of the 8 slots into the zero flag. Then you can use the normal jump instructions.

This PR wasn't really ready to be merged yet, but I'll submit another one to your floating_point branch to do some cleanup.