ucontext.h 2.6 KB

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