ucontext.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Copyright (C) 1997, 1999, 2001 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. /* System V/m68k ABI compliant context switching support. */
  15. #ifndef _SYS_UCONTEXT_H
  16. #define _SYS_UCONTEXT_H 1
  17. #include <features.h>
  18. #include <signal.h>
  19. /* Type for general register. */
  20. typedef int greg_t;
  21. /* Number of general registers. */
  22. #define NGREG 18
  23. /* Container for all general registers. */
  24. typedef greg_t gregset_t[NGREG];
  25. /* Number of each register is the `gregset_t' array. */
  26. enum
  27. {
  28. R_D0 = 0,
  29. #define R_D0 R_D0
  30. R_D1 = 1,
  31. #define R_D1 R_D1
  32. R_D2 = 2,
  33. #define R_D2 R_D2
  34. R_D3 = 3,
  35. #define R_D3 R_D3
  36. R_D4 = 4,
  37. #define R_D4 R_D4
  38. R_D5 = 5,
  39. #define R_D5 R_D5
  40. R_D6 = 6,
  41. #define R_D6 R_D6
  42. R_D7 = 7,
  43. #define R_D7 R_D7
  44. R_A0 = 8,
  45. #define R_A0 R_A0
  46. R_A1 = 9,
  47. #define R_A1 R_A1
  48. R_A2 = 10,
  49. #define R_A2 R_A2
  50. R_A3 = 11,
  51. #define R_A3 R_A3
  52. R_A4 = 12,
  53. #define R_A4 R_A4
  54. R_A5 = 13,
  55. #define R_A5 R_A5
  56. R_A6 = 14,
  57. #define R_A6 R_A6
  58. R_A7 = 15,
  59. #define R_A7 R_A7
  60. R_SP = 15,
  61. #define R_SP R_SP
  62. R_PC = 16,
  63. #define R_PC R_PC
  64. R_PS = 17
  65. #define R_PS R_PS
  66. };
  67. /* Structure to describe FPU registers. */
  68. typedef struct fpregset
  69. {
  70. int f_fpregs[8][3];
  71. int f_pcr;
  72. int f_psr;
  73. int f_fpiaddr;
  74. } fpregset_t;
  75. /* Context to describe whole processor state. */
  76. typedef struct
  77. {
  78. int version;
  79. gregset_t gregs;
  80. fpregset_t fpregs;
  81. } mcontext_t;
  82. #define MCONTEXT_VERSION 2
  83. /* Userlevel context. */
  84. typedef struct ucontext
  85. {
  86. unsigned long int uc_flags;
  87. struct ucontext *uc_link;
  88. __sigset_t uc_sigmask;
  89. stack_t uc_stack;
  90. mcontext_t uc_mcontext;
  91. long int uc_filler[174];
  92. } ucontext_t;
  93. #endif /* sys/ucontext.h */