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

Resolve #51, use new asm! macro #115

Merged
merged 16 commits into from
Jan 28, 2021

Conversation

maelgui
Copy link
Contributor

@maelgui maelgui commented Jan 21, 2021

Resolve issue #51

We replaced all the llvm_asm! call with the new asm! macro, which implies:

  • Use intel syntax by default (coherent with asm code used in the project)
  • We tried to choose the best option (nomem, nostack, etc...) for each call
  • "m" memory operand does not exist anymore, which implies passing reference address through a register

We tried to ensure the generated assembly stayed the same, using rust playground.

@ALSchwalm
Copy link
Collaborator

Awesome! I'll take a look at this tomorrow. Before merger though, I'd like some of these commits squashed, e.g.
92d1672 looks like a fix for an earlier commit, and f385de6 has the same commit message as c9e846f. But at a glance this looks really solid.

@maelgui
Copy link
Contributor Author

maelgui commented Jan 22, 2021

I rewrote the history, and squashed the two or three commits that were the same.

@ALSchwalm
Copy link
Collaborator

Ok, reading through these changes it looks good to me. I had one concern, which is that in a few places we no longer express that the rflags register is clobbered by the asm. However, it appears that is not possible to specify, as it is implied unless preserves_flags is set (per rust-lang/project-inline-asm#5). Does that align with your understanding of things? I'm not that familiar with the new asm stuff (but it certainly seems nicer to use than llvm_asm).

Thanks again for working on this.

@ALSchwalm
Copy link
Collaborator

I'm going to go ahead and merge this. Thanks for the contribution!

@ALSchwalm ALSchwalm merged commit f2e3436 into mythril-hypervisor:master Jan 28, 2021
@paulcacheux
Copy link
Contributor

Thanks for merging it. What you figured about preserves_flags matches our understanding of the new macro. It seems that the new options of the asm! macro are defined as opposites of the old llvm_asm ones such as no options is nearly always at least correct and then you can optimize by providing more information (like nomem, nostack, pure, preserves_flags, etc).

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

Successfully merging this pull request may close these issues.

4 participants