sigcontext.h 3.6 KB

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