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

Does ddisasm work for Risc-V binaries? #43

Open
SaiVK opened this issue Feb 20, 2022 · 6 comments
Open

Does ddisasm work for Risc-V binaries? #43

SaiVK opened this issue Feb 20, 2022 · 6 comments

Comments

@SaiVK
Copy link

SaiVK commented Feb 20, 2022

Hello Everyone
Can ddisasm be applied to Risc-V binaries to generate relocatable-assembly code and perform CFG analysis etc...?

Thanking you
Sai

@eschulte
Copy link
Contributor

We do not have any support for Risc-V binaries yet.

But we are open to contributions and Capstone does support Risc-V so the external dependency for Risc-V is satisfied.

@SaiVK
Copy link
Author

SaiVK commented Feb 22, 2022

Hello @eschulte
Is there any docs or any pointers to extend ddisasm? Also, does GTIRB support Risc-V backend?

Thanking you
Sai

@eschulte
Copy link
Contributor

The changes on the GTIRB side should be minimal, basically just adding RISC-V to the ISA enum in our protobuf module definition and to the corresponding ISA enums in our Python, Java, and Common Lisp APIs. That part should be trivial.

On the DDisasm side I'd look under src/datalog/arch and src/gtirb-decoder/arch and then mimic what you see for another ISA, e.g. arm64. We try to keep the ddisasm code largely segregated by ISA so each ISA's implementation is in its own file. Probably @kwarrick would have more advice here.

Also, if you're considering this (which would be awesome!), do be aware of our code of conduct and the fact that we ask all contributors to DDisasm to sign our contributor license agreement which give GrammaTech rights to your contributions to DDisasm so that we can maintain our GPL.

@eschulte eschulte reopened this Feb 22, 2022
@SaiVK
Copy link
Author

SaiVK commented Feb 23, 2022

Thank you @eschulte. I will probably start working on some small binary rewriting examples w.r.t x86 backend to get accustomed to ddisasm. And then try looking into RiscV backend.

-Sai

@aeflores
Copy link
Collaborator

@SaiVK you will probably want to extend gtirb-pprinter (https://github.com/grammatech/gtirb-pprinter) as well, so it can print RISC-V gtirb files. Similarly to ddisasm, you might want to look at how other ISAs are implemented there, such as ARM64 https://github.com/GrammaTech/gtirb-pprinter/blob/master/src/gtirb_pprinter/Arm64PrettyPrinter.cpp to get an idea of what is needed.

@SaiVK
Copy link
Author

SaiVK commented Feb 24, 2022

Thanks, @aeflores for the pointers. I will look into it.

-Sai

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

No branches or pull requests

3 participants