Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdf81f5
commit 64811ed
Showing
6 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CHECK: cc_plus_one_cxx | ||
CHECK: lfence | ||
CHECK: popq | ||
CHECK-NEXT: popq [[REGISTER:%[a-z]+]] | ||
CHECK-NEXT: lfence | ||
CHECK-NEXT: jmpq *[[REGISTER]] |
16 changes: 16 additions & 0 deletions
16
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CHECK: cc_plus_one_cxx_asm | ||
CHECK: lfence | ||
CHECK: lfence | ||
CHECK: lfence | ||
CHECK: movl | ||
CHECK: lfence | ||
CHECK: lfence | ||
CHECK-NEXT: incl | ||
CHECK-NEXT: jmp 0x{{[[:xdigit:]]+}} <cc_plus_one_cxx_asm+0x{{[[:xdigit:]]+}}> | ||
CHECK-NEXT: shlq $0, (%rsp) | ||
CHECK-NEXT: lfence | ||
CHECK-NEXT: retq | ||
CHECK: popq | ||
CHECK-NEXT: popq [[REGISTER:%[a-z]+]] | ||
CHECK-NEXT: lfence | ||
CHECK-NEXT: jmpq *[[REGISTER]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
extern "C" int cc_plus_one_cxx(int *arg); | ||
extern "C" int cc_plus_one_cxx_asm(int *arg); | ||
|
||
int cc_plus_one_cxx(int *arg) { | ||
return *arg + 1; | ||
} | ||
|
||
int cc_plus_one_cxx_asm(int *arg) { | ||
int value = 0; | ||
|
||
asm volatile ( " movl (%1), %0\n" | ||
" inc %0\n" | ||
" jmp 1f\n" | ||
" retq\n" // never executed, but a shortcut to determine how the assembler deals with `ret` instructions | ||
"1:\n" | ||
: "=r"(value) | ||
: "r"(arg) ); | ||
|
||
return value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters