ucontext.h 3.1 KB

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