]> git.lizzy.rs Git - rust.git/commitdiff
Revert SGX inline asm syntax
authorJethro Beekman <jethro@fortanix.com>
Fri, 7 May 2021 21:49:24 +0000 (23:49 +0200)
committerJethro Beekman <jethro@fortanix.com>
Fri, 7 May 2021 21:49:24 +0000 (23:49 +0200)
This was erroneously changed in #83387

library/std/src/os/fortanix_sgx/arch.rs
library/std/src/sys/sgx/abi/mem.rs

index b0170e67446db4c5cb659c39bfa5ba9468aed2c7..4ce482e23cbfb98e80f1d256b08994a7b69babe1 100644 (file)
 
         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 {
@@ -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()
index 1e743894a9fea3444fbc1a71213354b5acee4248..52e8bec937c79b917e9533a9d9ff758539dfc377 100644 (file)
@@ -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