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

Inline assembly code #16

Open
zonyitoo opened this issue Oct 19, 2015 · 2 comments
Open

Inline assembly code #16

zonyitoo opened this issue Oct 19, 2015 · 2 comments
Assignees

Comments

@zonyitoo
Copy link
Owner

Right now the assembly is in a stand alone .S file with AT&T style. To easily make it compilable under windows without depending on gcc, i think those code could be inlined inside a Rust function.

@zonyitoo zonyitoo self-assigned this Oct 19, 2015
@zonyitoo
Copy link
Owner Author

Encountered problems:

  1. Every Rust function will first push %rbp onto the stack to save the frame pointer

@target-san
Copy link

That's not Rust-specific thing. AFAIK almost any compiler adds code to push/pop stack frame base. It's used mostly to reference arguments located on stack. I wouldn't depend on Rust compiler generating exactly this code every time. For inline assembly to work something like #[naked] is necessary.

And #[inline(always)] isn't an option - there should be function call, so we'll have return IP on top of stack.

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

No branches or pull requests

2 participants