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

Migrate from Capstone to Zydis (x86 architecture) #4832

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

tushar3q34
Copy link
Contributor

@tushar3q34 tushar3q34 commented Jan 10, 2025

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

  • Used ZydisDecodedInstruction and ZydisDecodedOperand instead of cs_x86 and cs_x86_op
  • Changed ESIL, RzIL and asm for x86 architecture
  • Currently, this PR fails ~300 tests due to different formatting and some x86-16 specific instructions

TODO in further commits :

  • Change Tests/code to account for differences in outputs presented by Capstone and Zydis
  • Find a workaround for x86-16 specific instructions (lcall,ljump etc)
  • Document functions of analysis_x86 and asm_x86 files

Test plan

...

Closing issues

closes #4709

...

@tushar3q34
Copy link
Contributor Author

tushar3q34 commented Jan 10, 2025

Changes in the tests/code :

  • Extra spaces, extra keywords (qword,dword) in disassembly. For the keywords part, I think there are some formatting options in Zydis so I will try looking at that
  • Changes in ESIL outputs
  • Handle ljmp and lcall. Zydis only uses call and jmp with deciding whether to far jump/call or not depending on operands. So I will look into it and handle the code and necessary testcases in further commits.
  • Handle warnings

@wargio
Copy link
Member

wargio commented Jan 10, 2025

Very well done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate from Capstone to Zydis for x86 and x86_64 architectures
2 participants