sigcontext.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* Copyright (C) 2002 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. #include <bits/wordsize.h>
  20. struct _fpreg
  21. {
  22. unsigned short significand[4];
  23. unsigned short exponent;
  24. };
  25. struct _fpxreg
  26. {
  27. unsigned short significand[4];
  28. unsigned short exponent;
  29. unsigned short padding[3];
  30. };
  31. struct _xmmreg
  32. {
  33. __uint32_t element[4];
  34. };
  35. #if __WORDSIZE == 32
  36. struct _fpstate
  37. {
  38. /* Regular FPU environment. */
  39. __uint32_t cw;
  40. __uint32_t sw;
  41. __uint32_t tag;
  42. __uint32_t ipoff;
  43. __uint32_t cssel;
  44. __uint32_t dataoff;
  45. __uint32_t datasel;
  46. struct _fpreg _st[8];
  47. unsigned short status;
  48. unsigned short magic;
  49. /* FXSR FPU environment. */
  50. __uint32_t _fxsr_env[6];
  51. __uint32_t mxcsr;
  52. __uint32_t reserved;
  53. struct _fpxreg _fxsr_st[8];
  54. struct _xmmreg _xmm[8];
  55. __uint32_t padding[56];
  56. };
  57. #ifndef sigcontext_struct
  58. /* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
  59. we need sigcontext. Some packages have come to rely on
  60. sigcontext_struct being defined on 32-bit x86, so define this for
  61. their benefit. */
  62. # define sigcontext_struct sigcontext
  63. #endif
  64. struct sigcontext
  65. {
  66. unsigned short gs, __gsh;
  67. unsigned short fs, __fsh;
  68. unsigned short es, __esh;
  69. unsigned short ds, __dsh;
  70. unsigned long edi;
  71. unsigned long esi;
  72. unsigned long ebp;
  73. unsigned long esp;
  74. unsigned long ebx;
  75. unsigned long edx;
  76. unsigned long ecx;
  77. unsigned long eax;
  78. unsigned long trapno;
  79. unsigned long err;
  80. unsigned long eip;
  81. unsigned short cs, __csh;
  82. unsigned long eflags;
  83. unsigned long esp_at_signal;
  84. unsigned short ss, __ssh;
  85. struct _fpstate * fpstate;
  86. unsigned long oldmask;
  87. unsigned long cr2;
  88. };
  89. #else /* __WORDSIZE == 64 */
  90. struct _fpstate
  91. {
  92. /* FPU environment matching the 64-bit FXSAVE layout. */
  93. __uint16_t cwd;
  94. __uint16_t swd;
  95. __uint16_t ftw;
  96. __uint16_t fop;
  97. __uint64_t rip;
  98. __uint64_t rdp;
  99. __uint32_t mxcsr;
  100. __uint32_t mxcr_mask;
  101. struct _fpxreg _st[8];
  102. struct _xmmreg _xmm[16];
  103. __uint32_t padding[24];
  104. };
  105. struct sigcontext
  106. {
  107. unsigned long r8;
  108. unsigned long r9;
  109. unsigned long r10;
  110. unsigned long r11;
  111. unsigned long r12;
  112. unsigned long r13;
  113. unsigned long r14;
  114. unsigned long r15;
  115. unsigned long rdi;
  116. unsigned long rsi;
  117. unsigned long rbp;
  118. unsigned long rbx;
  119. unsigned long rdx;
  120. unsigned long rax;
  121. unsigned long rcx;
  122. unsigned long rsp;
  123. unsigned long rip;
  124. unsigned long eflags;
  125. unsigned short cs;
  126. unsigned short gs;
  127. unsigned short fs;
  128. unsigned short __pad0;
  129. unsigned long err;
  130. unsigned long trapno;
  131. unsigned long oldmask;
  132. unsigned long cr2;
  133. struct _fpstate * fpstate;
  134. unsigned long __reserved1 [8];
  135. };
  136. #endif /* __WORDSIZE == 64 */
  137. #endif /* _BITS_SIGCONTEXT_H */