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

Prefer asm! in std - all in sgx module #77292

Merged
merged 1 commit into from
Sep 30, 2020
Merged

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Sep 28, 2020

Similar to the change in #76669 but all llvm_asm! is gate in x86/x86_64 target.
Godbolt:

@tesuji
Copy link
Contributor Author

tesuji commented Sep 28, 2020

cc @jethrogb
r? @Amanieu

asm!(
"lea IMAGE_BASE(%rip), {}",
lateout(reg) base,
// FIXME(#76738): ATT syntax is used to support LLVM 8 and 9.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't require a FIXME (same for other similar comments throughout the PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fellow contributors may not know this and try to convert to intel syntax.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok but FIXME implies this needs to be changed, which is not the case.

Copy link
Contributor Author

@tesuji tesuji Sep 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be change in the future when #76738 resolved.
But I could change it to a NOTE if you prefer.

"lea IMAGE_BASE(%rip), {}",
lateout(reg) base,
// FIXME(#76738): ATT syntax is used to support LLVM 8 and 9.
options(att_syntax, nostack),
Copy link
Contributor

@jethrogb jethrogb Sep 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: preserves_flags, nomem.

Does nomem imply nostack?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nostack is separate from nomem: you can still allocate and use stack memory with nomem as long as you don't access any memory outside the asm.

in("rbx") request,
in("rcx") out.as_mut_ptr(),
// FIXME(#76738): ATT syntax is used to support LLVM 8 and 9.
options(att_syntax, preserves_flags),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly not preserves_flags. But you can use nostack.

library/std/src/sys/sgx/ext/arch.rs Outdated Show resolved Hide resolved
in("rcx") reportdata,
in("rdx") report.as_mut_ptr(),
// FIXME(#76738): ATT syntax is used to support LLVM 8 and 9.
options(att_syntax),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: preserves_flags, nostack.

@tesuji
Copy link
Contributor Author

tesuji commented Sep 28, 2020

Passed CI, just fall at upload state, which it should be.

@Amanieu
Copy link
Member

Amanieu commented Sep 28, 2020

LGTM

@tesuji tesuji marked this pull request as ready for review September 28, 2020 13:09
@Amanieu
Copy link
Member

Amanieu commented Sep 28, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Sep 28, 2020

📌 Commit d477201 has been approved by Amanieu

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 28, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 28, 2020
Prefer asm! in std - all in sgx module

Similar to the change in rust-lang#76669 but all `llvm_asm!` is gate in x86/x86_64 target.
Godbolt:
- https://rust.godbolt.org/z/h7nG1h
- https://rust.godbolt.org/z/xx39hW

r? @ghost
@bors
Copy link
Contributor

bors commented Sep 30, 2020

⌛ Testing commit d477201 with merge c0127e4...

@bors
Copy link
Contributor

bors commented Sep 30, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Amanieu
Pushing c0127e4 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 30, 2020
@bors bors merged commit c0127e4 into rust-lang:master Sep 30, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 30, 2020
@tesuji tesuji deleted the std_asm branch September 30, 2020 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants