sigcontext.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* Copyright (C) 2002-2016 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library 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 GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _BITS_SIGCONTEXT_H
  15. #define _BITS_SIGCONTEXT_H 1
  16. #if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
  17. # error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
  18. #endif
  19. #define FP_XSTATE_MAGIC1 0x46505853U
  20. #define FP_XSTATE_MAGIC2 0x46505845U
  21. #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
  22. struct _fpx_sw_bytes
  23. {
  24. __uint32_t magic1;
  25. __uint32_t extended_size;
  26. __uint64_t xstate_bv;
  27. __uint32_t xstate_size;
  28. __uint32_t padding[7];
  29. };
  30. struct _fpreg
  31. {
  32. unsigned short significand[4];
  33. unsigned short exponent;
  34. };
  35. struct _fpxreg
  36. {
  37. unsigned short significand[4];
  38. unsigned short exponent;
  39. unsigned short padding[3];
  40. };
  41. struct _xmmreg
  42. {
  43. __uint32_t element[4];
  44. };
  45. #ifndef __x86_64__
  46. struct _fpstate
  47. {
  48. /* Regular FPU environment. */
  49. __uint32_t cw;
  50. __uint32_t sw;
  51. __uint32_t tag;
  52. __uint32_t ipoff;
  53. __uint32_t cssel;
  54. __uint32_t dataoff;
  55. __uint32_t datasel;
  56. struct _fpreg _st[8];
  57. unsigned short status;
  58. unsigned short magic;
  59. /* FXSR FPU environment. */
  60. __uint32_t _fxsr_env[6];
  61. __uint32_t mxcsr;
  62. __uint32_t reserved;
  63. struct _fpxreg _fxsr_st[8];
  64. struct _xmmreg _xmm[8];
  65. __uint32_t padding[56];
  66. };
  67. #ifndef sigcontext_struct
  68. /* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
  69. we need sigcontext. Some packages have come to rely on
  70. sigcontext_struct being defined on 32-bit x86, so define this for
  71. their benefit. */
  72. # define sigcontext_struct sigcontext
  73. #endif
  74. #define X86_FXSR_MAGIC 0x0000
  75. struct sigcontext
  76. {
  77. unsigned short gs, __gsh;
  78. unsigned short fs, __fsh;
  79. unsigned short es, __esh;
  80. unsigned short ds, __dsh;
  81. unsigned long edi;
  82. unsigned long esi;
  83. unsigned long ebp;
  84. unsigned long esp;
  85. unsigned long ebx;
  86. unsigned long edx;
  87. unsigned long ecx;
  88. unsigned long eax;
  89. unsigned long trapno;
  90. unsigned long err;
  91. unsigned long eip;
  92. unsigned short cs, __csh;
  93. unsigned long eflags;
  94. unsigned long esp_at_signal;
  95. unsigned short ss, __ssh;
  96. struct _fpstate * fpstate;
  97. unsigned long oldmask;
  98. unsigned long cr2;
  99. };
  100. #else /* __x86_64__ */
  101. struct _fpstate
  102. {
  103. /* FPU environment matching the 64-bit FXSAVE layout. */
  104. __uint16_t cwd;
  105. __uint16_t swd;
  106. __uint16_t ftw;
  107. __uint16_t fop;
  108. __uint64_t rip;
  109. __uint64_t rdp;
  110. __uint32_t mxcsr;
  111. __uint32_t mxcr_mask;
  112. struct _fpxreg _st[8];
  113. struct _xmmreg _xmm[16];
  114. __uint32_t padding[24];
  115. };
  116. struct sigcontext
  117. {
  118. __uint64_t r8;
  119. __uint64_t r9;
  120. __uint64_t r10;
  121. __uint64_t r11;
  122. __uint64_t r12;
  123. __uint64_t r13;
  124. __uint64_t r14;
  125. __uint64_t r15;
  126. __uint64_t rdi;
  127. __uint64_t rsi;
  128. __uint64_t rbp;
  129. __uint64_t rbx;
  130. __uint64_t rdx;
  131. __uint64_t rax;
  132. __uint64_t rcx;
  133. __uint64_t rsp;
  134. __uint64_t rip;
  135. __uint64_t eflags;
  136. unsigned short cs;
  137. unsigned short gs;
  138. unsigned short fs;
  139. unsigned short __pad0;
  140. __uint64_t err;
  141. __uint64_t trapno;
  142. __uint64_t oldmask;
  143. __uint64_t cr2;
  144. __extension__ union
  145. {
  146. struct _fpstate * fpstate;
  147. __uint64_t __fpstate_word;
  148. };
  149. __uint64_t __reserved1 [8];
  150. };
  151. #endif /* __x86_64__ */
  152. struct _xsave_hdr
  153. {
  154. __uint64_t xstate_bv;
  155. __uint64_t reserved1[2];
  156. __uint64_t reserved2[5];
  157. };
  158. struct _ymmh_state
  159. {
  160. __uint32_t ymmh_space[64];
  161. };
  162. struct _xstate
  163. {
  164. struct _fpstate fpstate;
  165. struct _xsave_hdr xstate_hdr;
  166. struct _ymmh_state ymmh;
  167. };
  168. #endif /* _BITS_SIGCONTEXT_H */