2
0

signal.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  2. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  3. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  4. #define MINSIGSTKSZ 6144
  5. #define SIGSTKSZ 12288
  6. #endif
  7. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  8. typedef unsigned long greg_t;
  9. typedef unsigned long gregset_t[34];
  10. typedef struct {
  11. __uint128_t vregs[32];
  12. unsigned int fpsr;
  13. unsigned int fpcr;
  14. } fpregset_t;
  15. typedef struct sigcontext {
  16. unsigned long fault_address;
  17. unsigned long regs[31];
  18. unsigned long sp, pc, pstate;
  19. long double __reserved[256];
  20. } mcontext_t;
  21. #define FPSIMD_MAGIC 0x46508001
  22. #define ESR_MAGIC 0x45535201
  23. #define EXTRA_MAGIC 0x45585401
  24. #define SVE_MAGIC 0x53564501
  25. struct _aarch64_ctx {
  26. unsigned int magic;
  27. unsigned int size;
  28. };
  29. struct fpsimd_context {
  30. struct _aarch64_ctx head;
  31. unsigned int fpsr;
  32. unsigned int fpcr;
  33. __uint128_t vregs[32];
  34. };
  35. struct esr_context {
  36. struct _aarch64_ctx head;
  37. unsigned long esr;
  38. };
  39. struct extra_context {
  40. struct _aarch64_ctx head;
  41. unsigned long datap;
  42. unsigned int size;
  43. unsigned int __reserved[3];
  44. };
  45. struct sve_context {
  46. struct _aarch64_ctx head;
  47. unsigned short vl;
  48. unsigned short __reserved[3];
  49. };
  50. #define SVE_VQ_BYTES 16
  51. #define SVE_VQ_MIN 1
  52. #define SVE_VQ_MAX 512
  53. #define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES)
  54. #define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES)
  55. #define SVE_NUM_ZREGS 32
  56. #define SVE_NUM_PREGS 16
  57. #define sve_vl_valid(vl) \
  58. ((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
  59. #define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
  60. #define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
  61. #define SVE_SIG_ZREG_SIZE(vq) ((unsigned)(vq) * SVE_VQ_BYTES)
  62. #define SVE_SIG_PREG_SIZE(vq) ((unsigned)(vq) * (SVE_VQ_BYTES / 8))
  63. #define SVE_SIG_FFR_SIZE(vq) SVE_SIG_PREG_SIZE(vq)
  64. #define SVE_SIG_REGS_OFFSET \
  65. ((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1)) \
  66. / SVE_VQ_BYTES * SVE_VQ_BYTES)
  67. #define SVE_SIG_ZREGS_OFFSET SVE_SIG_REGS_OFFSET
  68. #define SVE_SIG_ZREG_OFFSET(vq, n) \
  69. (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
  70. #define SVE_SIG_ZREGS_SIZE(vq) \
  71. (SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
  72. #define SVE_SIG_PREGS_OFFSET(vq) \
  73. (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
  74. #define SVE_SIG_PREG_OFFSET(vq, n) \
  75. (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
  76. #define SVE_SIG_PREGS_SIZE(vq) \
  77. (SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
  78. #define SVE_SIG_FFR_OFFSET(vq) \
  79. (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
  80. #define SVE_SIG_REGS_SIZE(vq) \
  81. (SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
  82. #define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
  83. #else
  84. typedef struct {
  85. long double __regs[18+256];
  86. } mcontext_t;
  87. #endif
  88. struct sigaltstack {
  89. void *ss_sp;
  90. int ss_flags;
  91. size_t ss_size;
  92. };
  93. typedef struct __ucontext {
  94. unsigned long uc_flags;
  95. struct __ucontext *uc_link;
  96. stack_t uc_stack;
  97. sigset_t uc_sigmask;
  98. mcontext_t uc_mcontext;
  99. } ucontext_t;
  100. #define SA_NOCLDSTOP 1
  101. #define SA_NOCLDWAIT 2
  102. #define SA_SIGINFO 4
  103. #define SA_ONSTACK 0x08000000
  104. #define SA_RESTART 0x10000000
  105. #define SA_NODEFER 0x40000000
  106. #define SA_RESETHAND 0x80000000
  107. #define SA_RESTORER 0x04000000
  108. #endif
  109. #define SIGHUP 1
  110. #define SIGINT 2
  111. #define SIGQUIT 3
  112. #define SIGILL 4
  113. #define SIGTRAP 5
  114. #define SIGABRT 6
  115. #define SIGIOT SIGABRT
  116. #define SIGBUS 7
  117. #define SIGFPE 8
  118. #define SIGKILL 9
  119. #define SIGUSR1 10
  120. #define SIGSEGV 11
  121. #define SIGUSR2 12
  122. #define SIGPIPE 13
  123. #define SIGALRM 14
  124. #define SIGTERM 15
  125. #define SIGSTKFLT 16
  126. #define SIGCHLD 17
  127. #define SIGCONT 18
  128. #define SIGSTOP 19
  129. #define SIGTSTP 20
  130. #define SIGTTIN 21
  131. #define SIGTTOU 22
  132. #define SIGURG 23
  133. #define SIGXCPU 24
  134. #define SIGXFSZ 25
  135. #define SIGVTALRM 26
  136. #define SIGPROF 27
  137. #define SIGWINCH 28
  138. #define SIGIO 29
  139. #define SIGPOLL 29
  140. #define SIGPWR 30
  141. #define SIGSYS 31
  142. #define SIGUNUSED SIGSYS
  143. #define _NSIG 65