ucontext.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2006 Free Software
  2. Foundation, Inc. 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. /* Don't rely on this, the interface is currently messed up and may need to
  15. be broken to be fixed. */
  16. #ifndef _SYS_UCONTEXT_H
  17. #define _SYS_UCONTEXT_H 1
  18. #include <features.h>
  19. #include <sgidefs.h>
  20. #include <signal.h>
  21. /* We need the signal context definitions even if they are not used
  22. included in <signal.h>. */
  23. #include <bits/sigcontext.h>
  24. /* Type for general register. Even in o32 we assume 64-bit registers,
  25. like the kernel. */
  26. __extension__ typedef unsigned long long int greg_t;
  27. /* Number of general registers. */
  28. #define NGREG 32
  29. #define NFPREG 32
  30. /* Container for all general registers. */
  31. typedef greg_t gregset_t[NGREG];
  32. /* Container for all FPU registers. */
  33. typedef struct fpregset {
  34. union {
  35. double fp_dregs[NFPREG];
  36. struct {
  37. float _fp_fregs;
  38. unsigned int _fp_pad;
  39. } fp_fregs[NFPREG];
  40. } fp_r;
  41. } fpregset_t;
  42. /* Context to describe whole processor state. */
  43. #if _MIPS_SIM == _ABIO32
  44. /* Earlier versions of glibc for mips had an entirely different
  45. definition of mcontext_t, that didn't even resemble the
  46. corresponding kernel data structure. Since all legitimate uses of
  47. ucontext_t in glibc mustn't have accessed anything beyond
  48. uc_mcontext and, even then, taking a pointer to it, casting it to
  49. sigcontext_t, and accessing it as such, which is what it has always
  50. been, this can still be rectified. Fortunately, makecontext,
  51. [gs]etcontext et all have never been implemented. */
  52. typedef struct
  53. {
  54. unsigned int regmask;
  55. unsigned int status;
  56. greg_t pc;
  57. gregset_t gregs;
  58. fpregset_t fpregs;
  59. unsigned int fp_owned;
  60. unsigned int fpc_csr;
  61. unsigned int fpc_eir;
  62. unsigned int used_math;
  63. unsigned int dsp;
  64. greg_t mdhi;
  65. greg_t mdlo;
  66. unsigned long hi1;
  67. unsigned long lo1;
  68. unsigned long hi2;
  69. unsigned long lo2;
  70. unsigned long hi3;
  71. unsigned long lo3;
  72. } mcontext_t;
  73. #else
  74. typedef struct
  75. {
  76. gregset_t gregs;
  77. fpregset_t fpregs;
  78. greg_t mdhi;
  79. greg_t hi1;
  80. greg_t hi2;
  81. greg_t hi3;
  82. greg_t mdlo;
  83. greg_t lo1;
  84. greg_t lo2;
  85. greg_t lo3;
  86. greg_t pc;
  87. unsigned int fpc_csr;
  88. unsigned int used_math;
  89. unsigned int dsp;
  90. unsigned int reserved;
  91. } mcontext_t;
  92. #endif
  93. /* Userlevel context. */
  94. typedef struct ucontext
  95. {
  96. unsigned long int uc_flags;
  97. struct ucontext *uc_link;
  98. stack_t uc_stack;
  99. mcontext_t uc_mcontext;
  100. __sigset_t uc_sigmask;
  101. } ucontext_t;
  102. #endif /* sys/ucontext.h */