ucontext.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* Copyright (C) 1998-2017 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/ARM 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. /* We need the signal context definitions even if they are not exposed
  20. by <signal.h>. */
  21. #include <bits/sigcontext.h>
  22. #include <bits/sigstack.h>
  23. typedef int greg_t;
  24. /* Number of general registers. */
  25. #define NGREG 18
  26. /* Container for all general registers. */
  27. typedef greg_t gregset_t[NGREG];
  28. /* Number of each register is the `gregset_t' array. */
  29. enum
  30. {
  31. REG_R0 = 0,
  32. #define REG_R0 REG_R0
  33. REG_R1 = 1,
  34. #define REG_R1 REG_R1
  35. REG_R2 = 2,
  36. #define REG_R2 REG_R2
  37. REG_R3 = 3,
  38. #define REG_R3 REG_R3
  39. REG_R4 = 4,
  40. #define REG_R4 REG_R4
  41. REG_R5 = 5,
  42. #define REG_R5 REG_R5
  43. REG_R6 = 6,
  44. #define REG_R6 REG_R6
  45. REG_R7 = 7,
  46. #define REG_R7 REG_R7
  47. REG_R8 = 8,
  48. #define REG_R8 REG_R8
  49. REG_R9 = 9,
  50. #define REG_R9 REG_R9
  51. REG_R10 = 10,
  52. #define REG_R10 REG_R10
  53. REG_R11 = 11,
  54. #define REG_R11 REG_R11
  55. REG_R12 = 12,
  56. #define REG_R12 REG_R12
  57. REG_R13 = 13,
  58. #define REG_R13 REG_R13
  59. REG_R14 = 14,
  60. #define REG_R14 REG_R14
  61. REG_R15 = 15
  62. #define REG_R15 REG_R15
  63. };
  64. struct _libc_fpstate
  65. {
  66. struct
  67. {
  68. unsigned int sign1:1;
  69. unsigned int unused:15;
  70. unsigned int sign2:1;
  71. unsigned int exponent:14;
  72. unsigned int j:1;
  73. unsigned int mantissa1:31;
  74. unsigned int mantissa0:32;
  75. } fpregs[8];
  76. unsigned int fpsr:32;
  77. unsigned int fpcr:32;
  78. unsigned char ftype[8];
  79. unsigned int init_flag;
  80. };
  81. /* Structure to describe FPU registers. */
  82. typedef struct _libc_fpstate fpregset_t;
  83. /* Context to describe whole processor state. This only describes
  84. the core registers; coprocessor registers get saved elsewhere
  85. (e.g. in uc_regspace, or somewhere unspecified on the stack
  86. during non-RT signal handlers). */
  87. typedef struct sigcontext mcontext_t;
  88. /* Userlevel context. */
  89. typedef struct ucontext
  90. {
  91. unsigned long uc_flags;
  92. struct ucontext *uc_link;
  93. stack_t uc_stack;
  94. mcontext_t uc_mcontext;
  95. __sigset_t uc_sigmask;
  96. unsigned long uc_regspace[128] __attribute__((__aligned__(8)));
  97. } ucontext_t;
  98. #endif /* sys/ucontext.h */