ucontext.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* Copyright (C) 1998, 1999, 2001, 2006 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; see the file COPYING.LIB. If
  13. not, see <http://www.gnu.org/licenses/>.  */
  14. /* Meta 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. #include <sys/procfs.h>
  20. /* We need the signal context definitions even if they are not used
  21. included in <signal.h>. */
  22. #include <bits/sigcontext.h>
  23. typedef int greg_t;
  24. /* Number of general registers. */
  25. #define NGREG 18
  26. /* Container for all general registers. */
  27. typedef elf_gregset_t gregset_t;
  28. /* Number of each register is the `gregset_t' array. */
  29. enum
  30. {
  31. R0 = 0,
  32. #define R0 R0
  33. R1 = 1,
  34. #define R1 R1
  35. R2 = 2,
  36. #define R2 R2
  37. R3 = 3,
  38. #define R3 R3
  39. R4 = 4,
  40. #define R4 R4
  41. R5 = 5,
  42. #define R5 R5
  43. R6 = 6,
  44. #define R6 R6
  45. R7 = 7,
  46. #define R7 R7
  47. R8 = 8,
  48. #define R8 R8
  49. R9 = 9,
  50. #define R9 R9
  51. R10 = 10,
  52. #define R10 R10
  53. R11 = 11,
  54. #define R11 R11
  55. R12 = 12,
  56. #define R12 R12
  57. R13 = 13,
  58. #define R13 R13
  59. R14 = 14,
  60. #define R14 R14
  61. R15 = 15
  62. #define R15 R15
  63. };
  64. /* Structure to describe FPU registers. */
  65. typedef elf_fpregset_t fpregset_t;
  66. /* Context to describe whole processor state. This only describes
  67. the core registers; coprocessor registers get saved elsewhere
  68. (e.g. in uc_regspace, or somewhere unspecified on the stack
  69. during non-RT signal handlers). */
  70. typedef struct sigcontext mcontext_t;
  71. /* Userlevel context. */
  72. typedef struct ucontext
  73. {
  74. unsigned long uc_flags;
  75. struct ucontext *uc_link;
  76. stack_t uc_stack;
  77. mcontext_t uc_mcontext;
  78. __sigset_t uc_sigmask;
  79. } ucontext_t;
  80. #endif /* sys/ucontext.h */