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

x86 RzIL uplifting #2747

Merged
merged 102 commits into from
Nov 28, 2022
Merged

x86 RzIL uplifting #2747

merged 102 commits into from
Nov 28, 2022

Conversation

DMaroo
Copy link
Member

@DMaroo DMaroo commented Jun 27, 2022

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

This PR intends to lift x86 ISA to RzIL. This is a GSoC 2022 project.
Relevant links:

Test plan

Highlighted in the proposal document.

Closing issues

Tracker issue: #2080

Notes

This is only the first in series of a bunch of pull requests which plan on lifting x86. The IL implementation in the PR has not been semantically verified but the generated IL code has been type checked.

More info on the plan can be found here: https://dmaroo.github.io/gsocx86lifting

@thestr4ng3r thestr4ng3r self-assigned this Jul 3, 2022
@XVilka XVilka mentioned this pull request Aug 1, 2022
38 tasks
@DMaroo DMaroo force-pushed the x86-il-migration branch from f796e31 to 1910f67 Compare August 6, 2022 13:44
@github-actions github-actions bot removed the API label Aug 14, 2022
@DMaroo DMaroo force-pushed the x86-il-migration branch 2 times, most recently from 70bfd16 to eb4264b Compare August 25, 2022 06:50
@DMaroo DMaroo force-pushed the x86-il-migration branch 2 times, most recently from 32862f2 to a21a050 Compare November 20, 2022 11:45
@DMaroo DMaroo marked this pull request as ready for review November 21, 2022 07:59
Copy link
Member

@thestr4ng3r thestr4ng3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have annotated all the places that are not yet covered by asm tests, so you can check them off one after another. This may be somewhat tedious, but it is quite important to have these all type-checked, especially with different bitness. In particular, we need tests for x86_64 too.
Here is the coverage report I used: x86_il.c.gcov.txt

The overall design and structure looks very nice to me, great job already!

@DMaroo
Copy link
Member Author

DMaroo commented Nov 25, 2022

I have added tests for x86-64 and x86-16. I am now working on improving coverage.

 * Implement functions for lifting x86 operands to RzIL
 * Implement RzIL for invalid instructions
 * Create an enum for flags in x86 `EFLAGS` register
 * Add `x86_il_{get,set}_eflags` utility functions to deal with flags
 * Add documentation format and documentation for the lifted
   instructions
 * Add `RET_NULL_IF_64BIT_OR_LOCK` macro for convenience
 * Add `MOD` and `SMOD` in `rz_il_opbuilder_*.h` for convenience
 * Format according to clang-format
  * Cast to correct types in case of address override prefix in case of
    `CMPS` instruction in 64 bits
  * Fix typo, and use `RDX` and `RAX`, instead of `EDX` and `EAX` in
    `DIV` implmentation for 64-bit operand
  * Update lifting of `LODS`, `MOVS`, `SCAS` and `STOS` instructions to
    cast the memaddr to correct width
  * Makes it easier for future contributors and other people
@DMaroo DMaroo added the RZIL label Nov 27, 2022
Copy link
Member

@XVilka XVilka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, great job! The x86_il.c file will grow pretty big. No need to do it right now, but surely we will need to split it into categories - e.g. separate arithmetic ops from memory ops, etc

  * Fix typos in Doxygen documentation
  * Add dummy implementation for `IN`, `OUT` and `WAIT`
  * Implement `LOOP` family of instructions
@github-actions github-actions bot removed the RZIL label Nov 27, 2022
@DMaroo DMaroo enabled auto-merge (squash) November 27, 2022 16:52
@wargio wargio disabled auto-merge November 27, 2022 17:03
@wargio
Copy link
Member

wargio commented Nov 27, 2022

@DMaroo run clang-format.

@DMaroo DMaroo enabled auto-merge (squash) November 27, 2022 17:09
@wargio wargio disabled auto-merge November 27, 2022 17:15
@wargio wargio enabled auto-merge (squash) November 27, 2022 17:16
@wargio wargio requested a review from XVilka November 27, 2022 17:17
@wargio wargio merged commit ce80a13 into dev Nov 28, 2022
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.

4 participants