• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*===---- cetintrin.h - CET intrinsic --------------------------------------===
2  *
3  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4  * See https://llvm.org/LICENSE.txt for license information.
5  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6  *
7  *===-----------------------------------------------------------------------===
8  */
9 
10 #ifndef __IMMINTRIN_H
11 #error "Never use <cetintrin.h> directly; include <immintrin.h> instead."
12 #endif
13 
14 #ifndef __CETINTRIN_H
15 #define __CETINTRIN_H
16 
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS                                                     \
19   __attribute__((__always_inline__, __nodebug__, __target__("shstk")))
20 
_incsspd(int __a)21 static __inline__ void __DEFAULT_FN_ATTRS _incsspd(int __a) {
22   __builtin_ia32_incsspd(__a);
23 }
24 
25 #ifdef __x86_64__
_incsspq(unsigned long long __a)26 static __inline__ void __DEFAULT_FN_ATTRS _incsspq(unsigned long long __a) {
27   __builtin_ia32_incsspq(__a);
28 }
29 #endif /* __x86_64__ */
30 
31 #ifdef __x86_64__
_inc_ssp(unsigned int __a)32 static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
33   __builtin_ia32_incsspq(__a);
34 }
35 #else /* __x86_64__ */
_inc_ssp(unsigned int __a)36 static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
37   __builtin_ia32_incsspd((int)__a);
38 }
39 #endif /* __x86_64__ */
40 
_rdsspd(unsigned int __a)41 static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a) {
42   return __builtin_ia32_rdsspd(__a);
43 }
44 
45 #ifdef __x86_64__
_rdsspq(unsigned long long __a)46 static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq(unsigned long long __a) {
47   return __builtin_ia32_rdsspq(__a);
48 }
49 #endif /* __x86_64__ */
50 
51 #ifdef __x86_64__
_get_ssp(void)52 static __inline__ unsigned long long __DEFAULT_FN_ATTRS _get_ssp(void) {
53   return __builtin_ia32_rdsspq(0);
54 }
55 #else /* __x86_64__ */
_get_ssp(void)56 static __inline__ unsigned int __DEFAULT_FN_ATTRS _get_ssp(void) {
57   return __builtin_ia32_rdsspd(0);
58 }
59 #endif /* __x86_64__ */
60 
_saveprevssp()61 static __inline__ void __DEFAULT_FN_ATTRS _saveprevssp() {
62   __builtin_ia32_saveprevssp();
63 }
64 
_rstorssp(void * __p)65 static __inline__ void __DEFAULT_FN_ATTRS _rstorssp(void * __p) {
66   __builtin_ia32_rstorssp(__p);
67 }
68 
_wrssd(unsigned int __a,void * __p)69 static __inline__ void __DEFAULT_FN_ATTRS _wrssd(unsigned int __a, void * __p) {
70   __builtin_ia32_wrssd(__a, __p);
71 }
72 
73 #ifdef __x86_64__
_wrssq(unsigned long long __a,void * __p)74 static __inline__ void __DEFAULT_FN_ATTRS _wrssq(unsigned long long __a, void * __p) {
75   __builtin_ia32_wrssq(__a, __p);
76 }
77 #endif /* __x86_64__ */
78 
_wrussd(unsigned int __a,void * __p)79 static __inline__ void __DEFAULT_FN_ATTRS _wrussd(unsigned int __a, void * __p) {
80   __builtin_ia32_wrussd(__a, __p);
81 }
82 
83 #ifdef __x86_64__
_wrussq(unsigned long long __a,void * __p)84 static __inline__ void __DEFAULT_FN_ATTRS _wrussq(unsigned long long __a, void * __p) {
85   __builtin_ia32_wrussq(__a, __p);
86 }
87 #endif /* __x86_64__ */
88 
_setssbsy()89 static __inline__ void __DEFAULT_FN_ATTRS _setssbsy() {
90   __builtin_ia32_setssbsy();
91 }
92 
_clrssbsy(void * __p)93 static __inline__ void __DEFAULT_FN_ATTRS _clrssbsy(void * __p) {
94   __builtin_ia32_clrssbsy(__p);
95 }
96 
97 #undef __DEFAULT_FN_ATTRS
98 
99 #endif /* __CETINTRIN_H */
100