ucontext.h 3.3 KB

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