-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Add RzIL for floating-point x86 instructions #3865
Conversation
df8b835
to
487a2ea
Compare
1f596ea
to
444bf1f
Compare
4d7b434
to
80679fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also recommend taking some binary and targeting FP instructions located in it. Either one already in rizin-testbins, or take/compile a new one. Then, it can be tested as early as a subset of the instructions used is implemented.
I'm planning to write a testing 2D matrix multiplication code for floating point numbers to test the IL. I am not done with the arithmetic FP operations, so I need to lift them first before adding such a test. Maybe some programs from here can also be used: https://benchmarksgame-team.pages.debian.net/benchmarksgame/index.html. |
4c3f2e5
to
c08110f
Compare
b560deb
to
bc55191
Compare
50+ x86 floating point instructions have been lifted to RzIL! This is a significant majority of the x86 floating point instructions (discount SSE, MMX, AVX and other such ISA extensions). Most of the remaining instructions are either too complicated and rare to bother implementing or use transcendental operations unsupported by RzIL or are lower-level instructions which would not have any equivalent reasonable representation in RzIL. I believe the lifted instructions are more than enough to allow for a very satisfactory usage experience. I need to now add asm tests for all these instructions and then perform tracetesting. I am not adding any more instruction liftings until the testing of the existing liftings is over. |
1911073
to
f285206
Compare
ASM tests pass with the existing x86 FPU instructions in |
68aa3c5
to
c4621c8
Compare
43c3228
to
a34b196
Compare
* Define a new `X86ILContext` struct to pass around information whether we need to intitialize the rouding mode or not * Remove the global variable which was previously responsible for doing so
* We already test `WAIT` (in `db/asm/x86_32`) and `FSTSW` (or `FSTCW`) (in `db/asm/x86_64`) * Remove the newline replacement code in `rz-test` as well, since we wouldn't need that functionality anymore
* When we pop the FPU stack we pass in a `NULL` context since no resizing would be needed, which causes a failure if the non-null check for the `ctx` is outside the branch * Fixes failing tests in `db/asm`
* Incorrect implementation for `RET` and `CALL` * Swapped arguments for shift right
0a3b638
to
0a4aa7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though there is no emulateme test, I propose merging this before the release, just mention that this support is experimental in the release notes, and will be improved in the next one. What do you think?
* Move all unimplemented instructions to the end * Remove support for Capstone version less than 4
I agree about getting this merged. It is incorrect for some floating-point operations (due to the 80-bit floating-point shenanigans), but I'm confident that the rest of the instructions function as expected. |
Your checklist for this pull request
Detailed description
Add RzIL implementation for x86 floating point instructions. This is a WIP currently.
All the unrelated commits will go away once #3864 gets merged.Done.Test plan
Added tests in
db/asm/x86_64
. Pretty much all the instructions are covered. May add more tests depending on the code coverage.Tracetesting has been put on hold for now (see this comment), but will add the pending tracetesting in the tracker issue.
Closing issues
Closes #3861.