Skip to content

Commit

Permalink
fix: do not use rbx register in asm!()
Browse files Browse the repository at this point in the history
error: invalid register `rbx`: rbx is used internally by LLVM and
cannot be used as an operand for inline asm

See:
rust-lang/rust#84658 (comment)

and:
https://github.com/rust-lang/rust/pull/84658/files#diff-d7283132d97a993fad4e2d491ac883dbce4e17fe248cdf37fa3f9334e2a5a115
  • Loading branch information
haraldh committed May 3, 2021
1 parent 9e3617b commit d9c8adf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/attestation_types/ti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ impl TargetInfo {
let mut report = core::mem::MaybeUninit::<report::Report>::uninit();

asm!(
"xchg {RBX}, rbx",
"enclu",
"mov rbx, {RBX}",

RBX = inout(reg) self => _,
in("rax") EREPORT,
in("rbx") self,
in("rcx") data.0.as_ptr(),
in("rdx") report.as_mut_ptr(),
);
Expand Down

0 comments on commit d9c8adf

Please sign in to comment.