1 /*===---- cetintrin.h - CET intrinsic --------------------------------------===
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
7 *===-----------------------------------------------------------------------===
11 #error "Never use <cetintrin.h> directly; include <immintrin.h> instead."
17 /* Define the default attributes for the functions in this file. */
18 #define __DEFAULT_FN_ATTRS \
19 __attribute__((__always_inline__, __nodebug__, __target__("shstk")))
21 static __inline__ void __DEFAULT_FN_ATTRS _incsspd(int __a) {
22 __builtin_ia32_incsspd(__a);
26 static __inline__ void __DEFAULT_FN_ATTRS _incsspq(unsigned long long __a) {
27 __builtin_ia32_incsspq(__a);
29 #endif /* __x86_64__ */
32 static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
33 __builtin_ia32_incsspq(__a);
35 #else /* __x86_64__ */
36 static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
37 __builtin_ia32_incsspd((int)__a);
39 #endif /* __x86_64__ */
41 static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a) {
42 return __builtin_ia32_rdsspd(__a);
46 static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq(unsigned long long __a) {
47 return __builtin_ia32_rdsspq(__a);
49 #endif /* __x86_64__ */
52 static __inline__ unsigned long long __DEFAULT_FN_ATTRS _get_ssp(void) {
53 return __builtin_ia32_rdsspq(0);
55 #else /* __x86_64__ */
56 static __inline__ unsigned int __DEFAULT_FN_ATTRS _get_ssp(void) {
57 return __builtin_ia32_rdsspd(0);
59 #endif /* __x86_64__ */
61 static __inline__ void __DEFAULT_FN_ATTRS _saveprevssp() {
62 __builtin_ia32_saveprevssp();
65 static __inline__ void __DEFAULT_FN_ATTRS _rstorssp(void * __p) {
66 __builtin_ia32_rstorssp(__p);
69 static __inline__ void __DEFAULT_FN_ATTRS _wrssd(unsigned int __a, void * __p) {
70 __builtin_ia32_wrssd(__a, __p);
74 static __inline__ void __DEFAULT_FN_ATTRS _wrssq(unsigned long long __a, void * __p) {
75 __builtin_ia32_wrssq(__a, __p);
77 #endif /* __x86_64__ */
79 static __inline__ void __DEFAULT_FN_ATTRS _wrussd(unsigned int __a, void * __p) {
80 __builtin_ia32_wrussd(__a, __p);
84 static __inline__ void __DEFAULT_FN_ATTRS _wrussq(unsigned long long __a, void * __p) {
85 __builtin_ia32_wrussq(__a, __p);
87 #endif /* __x86_64__ */
89 static __inline__ void __DEFAULT_FN_ATTRS _setssbsy() {
90 __builtin_ia32_setssbsy();
93 static __inline__ void __DEFAULT_FN_ATTRS _clrssbsy(void * __p) {
94 __builtin_ia32_clrssbsy(__p);
97 #undef __DEFAULT_FN_ATTRS
99 #endif /* __CETINTRIN_H */