ucontext.h 2.8 KB

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