1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | #if !defined __X86INTRIN_H && !defined __IMMINTRIN_H |
25 | #error "Never use <sgxintrin.h> directly; include <x86intrin.h> instead." |
26 | #endif |
27 | |
28 | #ifndef __SGXINTRIN_H |
29 | #define __SGXINTRIN_H |
30 | |
31 | |
32 | #define __DEFAULT_FN_ATTRS \ |
33 | __attribute__((__always_inline__, __nodebug__, __target__("sgx"))) |
34 | |
35 | static __inline unsigned int __DEFAULT_FN_ATTRS |
36 | _enclu_u32(unsigned int __leaf, __SIZE_TYPE__ __d[]) |
37 | { |
38 | unsigned int __result; |
39 | __asm__ ("enclu" |
40 | : "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2]) |
41 | : "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2]) |
42 | : "cc"); |
43 | return __result; |
44 | } |
45 | |
46 | static __inline unsigned int __DEFAULT_FN_ATTRS |
47 | _encls_u32(unsigned int __leaf, __SIZE_TYPE__ __d[]) |
48 | { |
49 | unsigned int __result; |
50 | __asm__ ("encls" |
51 | : "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2]) |
52 | : "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2]) |
53 | : "cc"); |
54 | return __result; |
55 | } |
56 | |
57 | static __inline unsigned int __DEFAULT_FN_ATTRS |
58 | _enclv_u32(unsigned int __leaf, __SIZE_TYPE__ __d[]) |
59 | { |
60 | unsigned int __result; |
61 | __asm__ ("enclv" |
62 | : "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2]) |
63 | : "a" (__leaf), "b" (__d[0]), "c" (__d[1]), "d" (__d[2]) |
64 | : "cc"); |
65 | return __result; |
66 | } |
67 | |
68 | #undef __DEFAULT_FN_ATTRS |
69 | |
70 | #endif |
71 | |