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

Improve INTEL_MASM formatter style #543

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

widberg
Copy link

@widberg widberg commented Dec 7, 2024

I made fixes for the INTEL_MASM formatter style to get it closer to emitting assembly MASM accepts. This should be enough of an improvement to close #535.

I added the style to ZydisInfo and added tests. I also needed to change how the formatted buffer and restore worked since I couldn't get it to omit the first operand of FUCOMP without also omitting the mnemonic. There's a good chance this wasn't necessary and I was doing something wrong. These changes should also fix #497.

MASM doesn't have a mnemonic for the F1 opcode like int1 in other assemblers, so I made it emit INVALID_MNEMONIC in that case. It is possible to use a byte directive to emit the byte value directly but that seems out of scope for Zydis, if there is a different way you want this to be handled let me know. For int3 I had to break it up into int 3h for MASM to emit the CC opcode, I did this pretty hackily in the MASM format instruction function so that other hooks would still be able to handle it normally, let me know of a better way.

This is my first PR here so please let me know what I need to change to get this merged. I would like to see MASM support improve.

@widberg widberg marked this pull request as ready for review December 10, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant