ucontext.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* Copyright (C) 2011-2018 Free Software Foundation, Inc.
  2. The GNU C Library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Lesser General Public
  4. License as published by the Free Software Foundation; either
  5. version 2.1 of the License, or (at your option) any later version.
  6. The GNU C Library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Lesser General Public License for more details.
  10. You should have received a copy of the GNU Lesser General Public
  11. License along with the GNU C Library. If not, see
  12. <http://www.gnu.org/licenses/>. */
  13. #ifndef _SYS_UCONTEXT_H
  14. #define _SYS_UCONTEXT_H 1
  15. #include <features.h>
  16. #include <signal.h>
  17. #include <bits/sigcontext.h>
  18. #ifdef __USE_MISC
  19. # define __ctx(fld) fld
  20. #else
  21. # define __ctx(fld) __ ## fld
  22. #endif
  23. #ifdef __USE_MISC
  24. /* Get register type and register names. */
  25. # include <arch/abi.h>
  26. /* Type for general register. */
  27. typedef uint_reg_t greg_t;
  28. /* Number of general registers. Must agree with <asm/ptrace.h>. */
  29. # define NGREG 64
  30. /* Container for all general registers. */
  31. typedef greg_t gregset_t[NGREG];
  32. #endif
  33. #ifdef __USE_GNU
  34. /* Names for interesting registers in the `gregset_t' array. */
  35. enum
  36. {
  37. /* ... r0 through r51 are just 0 through 51 ... */
  38. REG_FP = TREG_FP,
  39. # define REG_FP REG_FP
  40. REG_TP = TREG_TP,
  41. # define REG_TP REG_TP
  42. REG_SP = TREG_SP,
  43. # define REG_SP REG_SP
  44. REG_LR = TREG_LR,
  45. # define REG_LR REG_LR
  46. };
  47. #endif
  48. #define __need_int_reg_t
  49. #include <arch/abi.h>
  50. /* A machine context is exactly a sigcontext. */
  51. typedef struct
  52. {
  53. __extension__ union
  54. {
  55. __uint_reg_t __ctx(gregs)[56];
  56. __extension__ struct
  57. {
  58. __uint_reg_t __ctx(__gregs)[53];
  59. __uint_reg_t __ctx(tp);
  60. __uint_reg_t __ctx(sp);
  61. __uint_reg_t __ctx(lr);
  62. };
  63. };
  64. __uint_reg_t __ctx(pc);
  65. __uint_reg_t __ctx(ics);
  66. __uint_reg_t __ctx(faultnum);
  67. __uint_reg_t __glibc_reserved1[5];
  68. } mcontext_t;
  69. /* Userlevel context. */
  70. typedef struct ucontext_t
  71. {
  72. unsigned long int __ctx(uc_flags);
  73. struct ucontext_t *uc_link;
  74. stack_t uc_stack;
  75. mcontext_t uc_mcontext;
  76. sigset_t uc_sigmask;
  77. } ucontext_t;
  78. #undef __ctx
  79. #endif /* sys/ucontext.h */