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

Revert SGX inline asm syntax #85054

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions library/std/src/os/fortanix_sgx/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32>

asm!(
// rbx is reserved by LLVM
"xchg {0}, rbx",
"xchg %rbx, {0}",
"enclu",
"mov rbx, {0}",
"mov {0}, %rbx",
inout(reg) request => _,
inlateout("eax") ENCLU_EGETKEY => error,
in("rcx") out.as_mut_ptr(),
options(nostack),
options(att_syntax, nostack),
);

match error {
Expand All @@ -64,14 +64,14 @@ pub fn ereport(

asm!(
// rbx is reserved by LLVM
"xchg {0}, rbx",
"xchg %rbx, {0}",
"enclu",
"mov rbx, {0}",
"mov {0}, %rbx",
inout(reg) targetinfo => _,
in("eax") ENCLU_EREPORT,
in("rcx") reportdata,
in("rdx") report.as_mut_ptr(),
options(preserves_flags, nostack),
options(att_syntax, preserves_flags, nostack),
);

report.assume_init()
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/sgx/abi/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ pub fn image_base() -> u64 {
let base: u64;
unsafe {
asm!(
"lea {}, qword ptr [rip + IMAGE_BASE]",
"lea IMAGE_BASE(%rip), {}",
lateout(reg) base,
options(nostack, preserves_flags, nomem, pure),
options(att_syntax, nostack, preserves_flags, nomem, pure),
)
};
base
Expand Down