-
Notifications
You must be signed in to change notification settings - Fork 14
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
Update to latest Zydis version #30
Comments
cc @th0rex :-) ? @johnined Zydis 4.0 is not officially released yet. We are planning to release it in the near future and afterwards the bindings probably will get updated as well. |
Yes I'll update it but I'm going to wait for the official release first (+ there might be some delay between the official release happening and me being able to start work on this). |
Ah I see. Until then is it possible Zydis-C could be updated to official release 3.2.1? |
Not really worth the effort: the v4 release is just around the corner. |
@athre0z v4 is now officially released, do you want help updating the bindings or does the update_40 branch have all the necessary migrations already? |
I think I ported most of the decoder stuff on that branch, but the encoder isn't fully implemented yet. I still had some smaller uncommitted changes locally that I pushed now. The |
I have bumped zydis-c version to 4.0.0, reviewed and (hopefully) accounted for all missing API changes in #31 |
Hey. Still waiting for a 4.0 release. Encoder support is a really useful feature and i wounder how is the development going and will we see the 4.0 version in the near future? |
Not a lot of time to work on this right now, but I am making some progress every now and then when I have a few minutes of spare times. Hope to be able to release a first beta version of this soonish, though it will probably not have the encoder at first. My priority is to first update and polish up all the function that this library provided in 3.0 before focusing on the 4.0 additions. |
Ok, I think I'm reasonably happy with what we have now and merged the |
I've started porting my project towards zydis v4 and here is my short feedback:
Here is my project: https://github.com/r3bb1t/vmp_analyzer. If you take a look at my code, you will understand why my code is gona become much bigger and less readable. (Yeah, it was not very good even before, but now will become even less readable 🌚) Here is an example Overall, i really appreciate all your work, this disassembler is the best one i've seen and i sincirely hope that it will get more recognition just like it deserves. I just wanted to share my thoughts and tell a bit about my experience using this library. P.s. Still waiting for full encoder support, that's the main reason i am moving from v3 to v4 🌞 |
Thanks for the feedback!
I addressed this part here -- this should allow you to Edit: ah wait, I think this implementation is actually buggy: the array might be partially uninitialized memory. I'll fix this up in a moment / sometime tomorrow. Edit 2: fixed in d16283a.
This is less a matter of making things more idiomatic somehow and more a matter of the Zydis v4 changes where (also in the C library) operand decoding is now a separate / optional step. A lot of users simply don't need operands, especially hidden ones, and decoding operands is wasted cycles in these cases.
type FullInstruction = Instruction<OperandArrayVec<MAX_OPERAND_COUNT>>; would improve the situation for you? |
Actually I just realized that I had already created these two aliases: https://docs.rs/zydis/4.0.0-beta.2/zydis/type.AllOperands.html So you could actually do |
Spent the weekend hacking up a high-level wrapper around the encoder interface and released I realized that X86 assembly is simple enough to be parsed by regular (non-procedural) Rust macros, so we can do stuff like: let mov = insn32!(MOV EDX, 0x1234).encode();
let add = insn64!(ADD dword ptr [RDX + RSI * 8 + 0x1234], 1234).encode(); It'll still be difficult to JIT anything of meaningful complexity without an assembler type with label support, but I'm undecided on whether we should add this in the Zydis bindings because it needs a bunch of OS specific plumbing. Perhaps it's best to leave that for a separate crate. |
This 2 macros look really beautiful and in fact look even more cooler than what keystone offers. Also shows the beauty of rust macros. I would really love to use them, it will also save lots of code and make it cleaner. I'm gona try to test all this in the next week and when I'll do it, i will give a feedback. I am really excited for the encoder support and I've been waiting for it so long. P.s. Don't forget to update the zydis C library which is linked to the project. (Because of various bugfixes, including the wrong output of a function which gets the largest register encoding) |
Note: For those experimenting with newer versions, you'll also need to run zydis-bindgen 😉 if you decide to upgrade zydis-c. https://github.com/zyantific/zydis-bindgen/tree/master In my case I needed encoder support, the encoder in current beta crate is not usable (it takes ownership rather than reference to encode buffer), so in addition to using upstream submodule, I figured I might aswell update. :P Happy coding. |
I just released I still want to do more usability improvements on the encoder API in the future -- some of which may end up being breaking -- but it seems that Zydis v5 will probably still happen within this year: lots of changes around Intel APX require some minor breaking changes in public C interface. I think the bindings are in a reasonably good state now, so I think that we can hold back any further API breaking changes until the not-so-far v5 update. Thank you everyone with your patience around the v4 binding update: this took way too long. v5 will in all likelihood come with only minor breaking changes, so I expect this to go much quicker next time. |
Are there any plans on updating these bindings to the latest Zydis version with encoder support?
The text was updated successfully, but these errors were encountered: