uintrintrin.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Copyright (C) 2020-2022 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. #ifndef _X86GPRINTRIN_H_INCLUDED
  19. # error "Never use <uintrintrin.h> directly; include <x86gprintrin.h> instead."
  20. #endif
  21. #ifndef _UINTRNTRIN_H_INCLUDED
  22. #define _UINTRNTRIN_H_INCLUDED
  23. #ifdef __x86_64__
  24. #ifndef __UINTR__
  25. #pragma GCC push_options
  26. #pragma GCC target ("uintr")
  27. #define __DISABLE_UINTR__
  28. #endif /* __UINTR__ */
  29. struct __uintr_frame
  30. {
  31. /* RIP of the interrupted user process. */
  32. unsigned long long rip;
  33. /* RFLAGS of the interrupted user process. */
  34. unsigned long long rflags;
  35. /* RSP of the interrupted user process. */
  36. unsigned long long rsp;
  37. };
  38. extern __inline void
  39. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  40. _clui (void)
  41. {
  42. __builtin_ia32_clui ();
  43. }
  44. extern __inline void
  45. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  46. _stui (void)
  47. {
  48. __builtin_ia32_stui ();
  49. }
  50. extern __inline void
  51. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  52. _senduipi (unsigned long long __R)
  53. {
  54. __builtin_ia32_senduipi (__R);
  55. }
  56. extern __inline unsigned char
  57. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  58. _testui (void)
  59. {
  60. return __builtin_ia32_testui ();
  61. }
  62. #ifdef __DISABLE_UINTR__
  63. #undef __DISABLE_UINTR__
  64. #pragma GCC pop_options
  65. #endif /* __DISABLE_UINTR__ */
  66. #endif
  67. #endif /* _UINTRNTRIN_H_INCLUDED. */