summaryrefslogtreecommitdiffstats
path: root/tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs
blob: 7eb3c6948ac57aa51bd621d1f665521604be1a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Test LVI load hardening on SGX enclave code

// assembly-output: emit-asm
// compile-flags: --crate-type staticlib
// only-x86_64-fortanix-unknown-sgx

#[no_mangle]
pub extern fn plus_one(r: &mut u64) {
    *r = *r + 1;
}

// CHECK: plus_one
// CHECK: lfence
// CHECK-NEXT: incq
// CHECK: popq [[REGISTER:%[a-z]+]]
// CHECK-NEXT: lfence
// CHECK-NEXT: jmpq *[[REGISTER]]