2020-03-19 09:47:50 -05:00
|
|
|
// Test LVI load hardening on SGX enclave code
|
|
|
|
|
2024-02-22 06:10:29 -06:00
|
|
|
//@ assembly-output: emit-asm
|
|
|
|
//@ compile-flags: --crate-type staticlib
|
|
|
|
//@ only-x86_64-fortanix-unknown-sgx
|
2020-03-19 09:47:50 -05:00
|
|
|
|
|
|
|
#[no_mangle]
|
2024-05-28 22:57:23 -05:00
|
|
|
pub extern "C" fn plus_one(r: &mut u64) {
|
2020-03-19 09:47:50 -05:00
|
|
|
*r = *r + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: plus_one
|
|
|
|
// CHECK: lfence
|
2023-02-21 09:30:30 -06:00
|
|
|
// CHECK-NEXT: incq
|
2020-03-19 09:47:50 -05:00
|
|
|
// CHECK: popq [[REGISTER:%[a-z]+]]
|
|
|
|
// CHECK-NEXT: lfence
|
|
|
|
// CHECK-NEXT: jmpq *[[REGISTER]]
|