sigcontext.h 3.5 KB

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