| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -msgx" } */ |
| 3 |
/* { dg-final { scan-assembler-times "enclu" 2 } } */ |
| 4 |
/* { dg-final { scan-assembler-times "encls" 2 } } */ |
| 5 |
/* { dg-final { scan-assembler-times "enclv" 2 } } */ |
| 6 |
|
| 7 |
#include <x86intrin.h> |
| 8 |
|
| 9 |
extern unsigned int leaf; |
| 10 |
|
| 11 |
#define SGX_EENTER 0x02 |
| 12 |
#define SGX_EBLOCK 0x09 |
| 13 |
#define SGX_EINCVIRTCHILD 0x01 |
| 14 |
|
| 15 |
int foo () |
| 16 |
{ |
| 17 |
size_t test[3]; |
| 18 |
test[0] = 4; |
| 19 |
test[1] = 5; |
| 20 |
test[2] = 6; |
| 21 |
|
| 22 |
unsigned int res1 = _encls_u32 (leaf, test); |
| 23 |
unsigned int res2 = _enclu_u32 (leaf, test); |
| 24 |
unsigned int res5 = _enclv_u32 (leaf, test); |
| 25 |
|
| 26 |
unsigned int res3 = _encls_u32 (SGX_EBLOCK, test); |
| 27 |
unsigned int res4 = _enclu_u32 (SGX_EENTER, test); |
| 28 |
unsigned int res6 = _enclv_u32 (SGX_EINCVIRTCHILD, test); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |