How to update RISCV-64 disassembly for extensions? #5744
Replies: 1 comment
-
The PR updating RISCV64 vector extensions should be ready by the end of the week. I'll bundle a proposed acceptance test in with the PR, essentially:
Note that this implicitly adopts several design elements from binutils:
None of these vector extension instructions generate pcode or provide further semantics for the decompiler. Issue #5769 raises some good points concerning pcode extensions for capturing memmov behavior. The RISCV-64 vector instruction provides a different approach to memmov, then goes on to implement many much more complex operations. GCC-14 intrinsics may give us some good examples on what to look for in SIMD pcode semantics. The development tip of libssl source code might also be worth looking into. |
Beta Was this translation helpful? Give feedback.
-
I'm planning on starting some PRs to improve RISCV-64 disassembly of instructions added as recent extensions. Has anyone suggestions or guidance on how to best approach this?
The biggest current problem is in Ghidra's handling of RISCV-64 vector extensions. Half of the vector instructions handled by binutils-2.41 are unimplemented in Ghidra 10.4.DEV, and many of those that are implemented disassemble incorrectly for the stable vector extension release.
The baseline approach is simple:
binutils-gdb/gas/testsuite/gas/riscv
. The Ghidra disassembly window should look a lot like whatobjdump -d
generates from the exemplar object files.There are a bunch of design questions this approach raises, questions I hope this community can comment on:
fence
instructions an 0xf operand is best rendered as something like 'iorw'.I expect to add some test harness code to https://github.com/thixotropist/ghidra_import_tests later this week, showing some of the current divergences between Ghidra and objdump.
Beta Was this translation helpful? Give feedback.
All reactions