cetintrin.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*===---- cetintrin.h - CET intrinsic ------------------------------------===
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. *
  21. *===-----------------------------------------------------------------------===
  22. */
  23. #ifndef __IMMINTRIN_H
  24. #error "Never use <cetintrin.h> directly; include <immintrin.h> instead."
  25. #endif
  26. #ifndef __CETINTRIN_H
  27. #define __CETINTRIN_H
  28. /* Define the default attributes for the functions in this file. */
  29. #define __DEFAULT_FN_ATTRS \
  30. __attribute__((__always_inline__, __nodebug__, __target__("shstk")))
  31. static __inline__ void __DEFAULT_FN_ATTRS _incsspd(int __a) {
  32. __builtin_ia32_incsspd(__a);
  33. }
  34. #ifdef __x86_64__
  35. static __inline__ void __DEFAULT_FN_ATTRS _incsspq(unsigned long long __a) {
  36. __builtin_ia32_incsspq(__a);
  37. }
  38. #endif /* __x86_64__ */
  39. static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a) {
  40. return __builtin_ia32_rdsspd(__a);
  41. }
  42. #ifdef __x86_64__
  43. static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq(unsigned long long __a) {
  44. return __builtin_ia32_rdsspq(__a);
  45. }
  46. #endif /* __x86_64__ */
  47. static __inline__ void __DEFAULT_FN_ATTRS _saveprevssp() {
  48. __builtin_ia32_saveprevssp();
  49. }
  50. static __inline__ void __DEFAULT_FN_ATTRS _rstorssp(void * __p) {
  51. __builtin_ia32_rstorssp(__p);
  52. }
  53. static __inline__ void __DEFAULT_FN_ATTRS _wrssd(unsigned int __a, void * __p) {
  54. __builtin_ia32_wrssd(__a, __p);
  55. }
  56. #ifdef __x86_64__
  57. static __inline__ void __DEFAULT_FN_ATTRS _wrssq(unsigned long long __a, void * __p) {
  58. __builtin_ia32_wrssq(__a, __p);
  59. }
  60. #endif /* __x86_64__ */
  61. static __inline__ void __DEFAULT_FN_ATTRS _wrussd(unsigned int __a, void * __p) {
  62. __builtin_ia32_wrussd(__a, __p);
  63. }
  64. #ifdef __x86_64__
  65. static __inline__ void __DEFAULT_FN_ATTRS _wrussq(unsigned long long __a, void * __p) {
  66. __builtin_ia32_wrussq(__a, __p);
  67. }
  68. #endif /* __x86_64__ */
  69. static __inline__ void __DEFAULT_FN_ATTRS _setssbsy() {
  70. __builtin_ia32_setssbsy();
  71. }
  72. static __inline__ void __DEFAULT_FN_ATTRS _clrssbsy(void * __p) {
  73. __builtin_ia32_clrssbsy(__p);
  74. }
  75. #undef __DEFAULT_FN_ATTRS
  76. #endif /* __CETINTRIN_H */