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((unsigned int)__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(__a
);
39 #endif /* __x86_64__ */
41 static __inline__
unsigned int __DEFAULT_FN_ATTRS
_rdsspd(unsigned int __a
) {
42 return __builtin_ia32_rdsspd(__a
);
45 static __inline__
unsigned int __DEFAULT_FN_ATTRS
_rdsspd_i32(void) {
46 #pragma clang diagnostic push
47 #pragma clang diagnostic ignored "-Wuninitialized"
49 return __builtin_ia32_rdsspd(t
);
50 #pragma clang diagnostic pop
54 static __inline__
unsigned long long __DEFAULT_FN_ATTRS
_rdsspq(unsigned long long __a
) {
55 return __builtin_ia32_rdsspq(__a
);
58 static __inline__
unsigned long long __DEFAULT_FN_ATTRS
_rdsspq_i64(void) {
59 #pragma clang diagnostic push
60 #pragma clang diagnostic ignored "-Wuninitialized"
62 return __builtin_ia32_rdsspq(t
);
63 #pragma clang diagnostic pop
65 #endif /* __x86_64__ */
68 static __inline__
unsigned long long __DEFAULT_FN_ATTRS
_get_ssp(void) {
69 return __builtin_ia32_rdsspq(0);
71 #else /* __x86_64__ */
72 static __inline__
unsigned int __DEFAULT_FN_ATTRS
_get_ssp(void) {
73 return __builtin_ia32_rdsspd(0);
75 #endif /* __x86_64__ */
77 static __inline__
void __DEFAULT_FN_ATTRS
_saveprevssp(void) {
78 __builtin_ia32_saveprevssp();
81 static __inline__
void __DEFAULT_FN_ATTRS
_rstorssp(void * __p
) {
82 __builtin_ia32_rstorssp(__p
);
85 static __inline__
void __DEFAULT_FN_ATTRS
_wrssd(unsigned int __a
, void * __p
) {
86 __builtin_ia32_wrssd(__a
, __p
);
90 static __inline__
void __DEFAULT_FN_ATTRS
_wrssq(unsigned long long __a
, void * __p
) {
91 __builtin_ia32_wrssq(__a
, __p
);
93 #endif /* __x86_64__ */
95 static __inline__
void __DEFAULT_FN_ATTRS
_wrussd(unsigned int __a
, void * __p
) {
96 __builtin_ia32_wrussd(__a
, __p
);
100 static __inline__
void __DEFAULT_FN_ATTRS
_wrussq(unsigned long long __a
, void * __p
) {
101 __builtin_ia32_wrussq(__a
, __p
);
103 #endif /* __x86_64__ */
105 static __inline__
void __DEFAULT_FN_ATTRS
_setssbsy(void) {
106 __builtin_ia32_setssbsy();
109 static __inline__
void __DEFAULT_FN_ATTRS
_clrssbsy(void * __p
) {
110 __builtin_ia32_clrssbsy(__p
);
113 #undef __DEFAULT_FN_ATTRS
115 #endif /* __CETINTRIN_H */