diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2021-04-30 18:27:12 +0100 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2021-04-30 18:27:12 +0100 |
| commit | 09cfb248e7b1765865bcc0c174c019acfec6681c (patch) | |
| tree | 2052b49129969f74a66462e5a0d91aec7252926f /library/std/src | |
| parent | e6a731eb90fe3d47d89416e199832af4248399f6 (diff) | |
| download | rust-09cfb248e7b1765865bcc0c174c019acfec6681c.tar.gz rust-09cfb248e7b1765865bcc0c174c019acfec6681c.zip | |
Avoid using rbx in SGX inline assembly since it is reserved
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/sgx/ext/arch.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/std/src/sys/sgx/ext/arch.rs b/library/std/src/sys/sgx/ext/arch.rs index 730db34e733..a6718006fe4 100644 --- a/library/std/src/sys/sgx/ext/arch.rs +++ b/library/std/src/sys/sgx/ext/arch.rs @@ -32,9 +32,12 @@ pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32> let error; asm!( + // rbx is reserved by LLVM + "xchg {}, rbx", "enclu", + "mov rbx, {}", + inout(reg) request => _, inlateout("eax") ENCLU_EGETKEY => error, - in("rbx") request, in("rcx") out.as_mut_ptr(), options(nostack), ); @@ -60,9 +63,12 @@ pub fn ereport( let mut report = MaybeUninit::uninit(); asm!( + // rbx is reserved by LLVM + "xchg {}, rbx", "enclu", + "mov rbx, {}", + inout(reg) targetinfo => _, in("eax") ENCLU_EREPORT, - in("rbx") targetinfo, in("rcx") reportdata, in("rdx") report.as_mut_ptr(), options(preserves_flags, nostack), |
