ucontext.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* Copyright (C) 1997, 1998, 1999, 2000 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 _SYS_UCONTEXT_H
  15. #define _SYS_UCONTEXT_H 1
  16. #include <features.h>
  17. #include <signal.h>
  18. /* We need the signal context definitions even if they are not used
  19. included in <signal.h>. */
  20. #include <bits/sigcontext.h>
  21. /* Type for general register. */
  22. typedef int greg_t;
  23. /* Number of general registers. */
  24. #define NGREG 19
  25. /* Container for all general registers. */
  26. typedef greg_t gregset_t[NGREG];
  27. #ifdef __USE_GNU
  28. /* Number of each register is the `gregset_t' array. */
  29. enum
  30. {
  31. REG_GS = 0,
  32. # define REG_GS REG_GS
  33. REG_FS,
  34. # define REG_FS REG_FS
  35. REG_ES,
  36. # define REG_ES REG_ES
  37. REG_DS,
  38. # define REG_DS REG_DS
  39. REG_EDI,
  40. # define REG_EDI REG_EDI
  41. REG_ESI,
  42. # define REG_ESI REG_ESI
  43. REG_EBP,
  44. # define REG_EBP REG_EBP
  45. REG_ESP,
  46. # define REG_ESP REG_ESP
  47. REG_EBX,
  48. # define REG_EBX REG_EBX
  49. REG_EDX,
  50. # define REG_EDX REG_EDX
  51. REG_ECX,
  52. # define REG_ECX REG_ECX
  53. REG_EAX,
  54. # define REG_EAX REG_EAX
  55. REG_TRAPNO,
  56. # define REG_TRAPNO REG_TRAPNO
  57. REG_ERR,
  58. # define REG_ERR REG_ERR
  59. REG_EIP,
  60. # define REG_EIP REG_EIP
  61. REG_CS,
  62. # define REG_CS REG_CS
  63. REG_EFL,
  64. # define REG_EFL REG_EFL
  65. REG_UESP,
  66. # define REG_UESP REG_UESP
  67. REG_SS
  68. # define REG_SS REG_SS
  69. };
  70. #endif
  71. /* Definitions taken from the kernel headers. */
  72. struct _libc_fpreg
  73. {
  74. unsigned short int significand[4];
  75. unsigned short int exponent;
  76. };
  77. struct _libc_fpstate
  78. {
  79. unsigned long int cw;
  80. unsigned long int sw;
  81. unsigned long int tag;
  82. unsigned long int ipoff;
  83. unsigned long int cssel;
  84. unsigned long int dataoff;
  85. unsigned long int datasel;
  86. struct _libc_fpreg _st[8];
  87. unsigned long int status;
  88. };
  89. /* Structure to describe FPU registers. */
  90. typedef struct _libc_fpstate *fpregset_t;
  91. /* Context to describe whole processor state. */
  92. typedef struct
  93. {
  94. gregset_t gregs;
  95. /* Due to Linux's history we have to use a pointer here. The SysV/i386
  96. ABI requires a struct with the values. */
  97. fpregset_t fpregs;
  98. unsigned long int oldmask;
  99. unsigned long int cr2;
  100. } mcontext_t;
  101. /* Userlevel context. */
  102. typedef struct ucontext
  103. {
  104. unsigned long int uc_flags;
  105. struct ucontext *uc_link;
  106. stack_t uc_stack;
  107. mcontext_t uc_mcontext;
  108. __sigset_t uc_sigmask;
  109. struct _libc_fpstate __fpregs_mem;
  110. } ucontext_t;
  111. #endif /* sys/ucontext.h */