ucontext.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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/blackfin 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 47
  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. REG_R0 = 0,
  29. #define REG_R0 REG_R0
  30. REG_R1 = 1,
  31. #define REG_R1 REG_R1
  32. REG_R2 = 2,
  33. #define REG_R2 REG_R2
  34. REG_R3 = 3,
  35. #define REG_R3 REG_R3
  36. REG_R4 = 4,
  37. #define REG_R4 REG_R4
  38. REG_R5 = 5,
  39. #define REG_R5 REG_R5
  40. REG_R6 = 6,
  41. #define REG_R6 REG_R6
  42. REG_R7 = 7,
  43. #define REG_R7 REG_R7
  44. REG_P0 = 8,
  45. #define REG_P0 REG_P0
  46. REG_P1 = 9,
  47. #define REG_P1 REG_P1
  48. REG_P2 = 10,
  49. #define REG_P2 REG_P2
  50. REG_P3 = 11,
  51. #define REG_P3 REG_P3
  52. REG_P4 = 12,
  53. #define REG_P4 REG_P4
  54. REG_P5 = 13,
  55. #define REG_P5 REG_P5
  56. REG_USP = 14,
  57. #define REG_USP REG_USP
  58. REG_A0W = 15,
  59. #define REG_A0W REG_A0W
  60. REG_A1W = 16,
  61. #define REG_A1W REG_A1W
  62. REG_A0X = 17,
  63. #define REG_A0X REG_A0X
  64. REG_A1X = 18,
  65. #define REG_A1X REG_A1X
  66. REG_ASTAT = 19,
  67. #define REG_ASTAT REG_ASTAT
  68. REG_RETS = 20,
  69. #define REG_RETS REG_RETS
  70. REG_PC= 21,
  71. #define REG_PC REG_PC
  72. REG_RETX = 22,
  73. #define REG_RETX REG_RETX
  74. REG_FP = 23,
  75. #define REG_FP REG_FP
  76. REG_I0 = 24,
  77. #define REG_I0 REG_I0
  78. REG_I1 = 25,
  79. #define REG_I1 REG_I1
  80. REG_I2 = 26,
  81. #define REG_I2 REG_I2
  82. REG_I3 = 27,
  83. #define REG_I3 REG_I3
  84. REG_M0 = 28,
  85. #define REG_M0 REG_M0
  86. REG_M1 = 29,
  87. #define REG_M1 REG_M1
  88. REG_M2 = 30,
  89. #define REG_M2 REG_M2
  90. REG_M3 = 31,
  91. #define REG_M3 REG_M3
  92. REG_L0 = 32,
  93. #define REG_L0 REG_L0
  94. REG_L1 = 33,
  95. #define REG_L1 REG_L1
  96. REG_L2 = 34,
  97. #define REG_L2 REG_L2
  98. REG_L3 = 35,
  99. #define REG_L3 REG_L3
  100. REG_B_0 = 36,
  101. #define REG_B0 REG_B0
  102. REG_B1 = 37,
  103. #define REG_B1 REG_B1
  104. REG_B2 = 38,
  105. #define REG_B2 REG_B2
  106. REG_B3 = 39,
  107. #define REG_B3 REG_B3
  108. REG_LC0 = 40,
  109. #define REG_LC0 REG_LC0
  110. REG_LC1 = 41,
  111. #define REG_LC1 REG_LC1
  112. REG_LT0 = 42,
  113. #define REG_LT0 REG_LT0
  114. REG_LT1 = 43,
  115. #define REG_LT1 REG_LT1
  116. REG_LB0 = 44,
  117. #define REG_LB0 REG_LB0
  118. REG_LB1 = 45,
  119. #define REG_LB1 REG_LB1
  120. REG_SEQSTAT = 46
  121. #define REG_SEQSTAT REG_SEQSTAT
  122. };
  123. /* Context to describe whole processor state. */
  124. typedef struct
  125. {
  126. gregset_t gregs;
  127. } mcontext_t;
  128. /* Userlevel context. */
  129. typedef struct ucontext
  130. {
  131. unsigned long int uc_flags;
  132. struct ucontext *uc_link;
  133. stack_t uc_stack;
  134. mcontext_t uc_mcontext;
  135. __sigset_t uc_sigmask;
  136. } ucontext_t;
  137. #endif /* sys/ucontext.h */