Skip to content

Commit

Permalink
Revert SGX inline asm syntax
Browse files Browse the repository at this point in the history
This was erroneously changed in rust-lang#83387
  • Loading branch information
Jethro Beekman committed May 7, 2021
1 parent ca712bc commit 5bbf8cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 5bbf8cf

Please sign in to comment.