ucontext.h 3.4 KB

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