Skip to content

Commit d6e344d

Browse files
authored
Rollup merge of rust-lang#85054 - jethrogb:jb/sgx-inline-asm, r=Amanieu
Revert SGX inline asm syntax This was erroneously changed in rust-lang#83387
2 parents 406d4a9 + 5bbf8cf commit d6e344d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

library/std/src/os/fortanix_sgx/arch.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32>
3333

3434
asm!(
3535
// rbx is reserved by LLVM
36-
"xchg {0}, rbx",
36+
"xchg %rbx, {0}",
3737
"enclu",
38-
"mov rbx, {0}",
38+
"mov {0}, %rbx",
3939
inout(reg) request => _,
4040
inlateout("eax") ENCLU_EGETKEY => error,
4141
in("rcx") out.as_mut_ptr(),
42-
options(nostack),
42+
options(att_syntax, nostack),
4343
);
4444

4545
match error {
@@ -64,14 +64,14 @@ pub fn ereport(
6464

6565
asm!(
6666
// rbx is reserved by LLVM
67-
"xchg {0}, rbx",
67+
"xchg %rbx, {0}",
6868
"enclu",
69-
"mov rbx, {0}",
69+
"mov {0}, %rbx",
7070
inout(reg) targetinfo => _,
7171
in("eax") ENCLU_EREPORT,
7272
in("rcx") reportdata,
7373
in("rdx") report.as_mut_ptr(),
74-
options(preserves_flags, nostack),
74+
options(att_syntax, preserves_flags, nostack),
7575
);
7676

7777
report.assume_init()

library/std/src/sys/sgx/abi/mem.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ pub fn image_base() -> u64 {
3636
let base: u64;
3737
unsafe {
3838
asm!(
39-
"lea {}, qword ptr [rip + IMAGE_BASE]",
39+
"lea IMAGE_BASE(%rip), {}",
4040
lateout(reg) base,
41-
options(nostack, preserves_flags, nomem, pure),
41+
options(att_syntax, nostack, preserves_flags, nomem, pure),
4242
)
4343
};
4444
base

0 commit comments

Comments
 (0)