sigcontext.h 3.6 KB

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