target_os_siginfo.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * FreeBSD siginfo related definitions
  3. *
  4. * Copyright (c) 2013 Stacey D. Son
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef TARGET_OS_SIGINFO_H
  20. #define TARGET_OS_SIGINFO_H
  21. #define TARGET_NSIG 128
  22. #define TARGET_NSIG_BPW (sizeof(uint32_t) * 8)
  23. #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
  24. /* this struct defines a stack used during syscall handling */
  25. typedef struct target_sigaltstack {
  26. abi_long ss_sp;
  27. abi_ulong ss_size;
  28. abi_long ss_flags;
  29. } target_stack_t;
  30. typedef struct {
  31. uint32_t __bits[TARGET_NSIG_WORDS];
  32. } target_sigset_t;
  33. struct target_sigaction {
  34. abi_ulong _sa_handler;
  35. int32_t sa_flags;
  36. target_sigset_t sa_mask;
  37. };
  38. typedef union target_sigval {
  39. int32_t sival_int;
  40. abi_ulong sival_ptr;
  41. int32_t sigval_int;
  42. abi_ulong sigval_ptr;
  43. } target_sigval_t;
  44. typedef struct target_siginfo {
  45. int32_t si_signo; /* signal number */
  46. int32_t si_errno; /* errno association */
  47. int32_t si_code; /* signal code */
  48. int32_t si_pid; /* sending process */
  49. int32_t si_uid; /* sender's ruid */
  50. int32_t si_status; /* exit value */
  51. abi_ulong si_addr; /* faulting instruction */
  52. union target_sigval si_value; /* signal value */
  53. union {
  54. struct {
  55. int32_t _trapno; /* machine specific trap code */
  56. } _fault;
  57. /* POSIX.1b timers */
  58. struct {
  59. int32_t _timerid;
  60. int32_t _overrun;
  61. } _timer;
  62. struct {
  63. int32_t _mqd;
  64. } _mesgp;
  65. /* SIGPOLL -- Not really generated in FreeBSD ??? */
  66. struct {
  67. int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  68. } _poll;
  69. struct {
  70. int _mqd;
  71. } _mesgq;
  72. struct {
  73. /*
  74. * Syscall number for signals delivered as a result of system calls
  75. * denied by Capsicum.
  76. */
  77. int _syscall;
  78. } _capsicum;
  79. /* Spare for future growth */
  80. struct {
  81. abi_long __spare1__;
  82. int32_t __spare2_[7];
  83. } __spare__;
  84. } _reason;
  85. } target_siginfo_t;
  86. struct target_sigevent {
  87. abi_int sigev_notify;
  88. abi_int sigev_signo;
  89. target_sigval_t sigev_value;
  90. union {
  91. abi_int _threadid;
  92. /*
  93. * The kernel (and thus QEMU) never looks at these;
  94. * they're only used as part of the ABI between a
  95. * userspace program and libc.
  96. */
  97. struct {
  98. abi_ulong _function;
  99. abi_ulong _attribute;
  100. } _sigev_thread;
  101. abi_ushort _kevent_flags;
  102. abi_long _pad[8];
  103. } _sigev_un;
  104. };
  105. #define target_si_signo si_signo
  106. #define target_si_code si_code
  107. #define target_si_errno si_errno
  108. #define target_si_addr si_addr
  109. /* SIGILL si_codes */
  110. #define TARGET_ILL_ILLOPC (1) /* Illegal opcode. */
  111. #define TARGET_ILL_ILLOPN (2) /* Illegal operand. */
  112. #define TARGET_ILL_ILLADR (3) /* Illegal addressing mode. */
  113. #define TARGET_ILL_ILLTRP (4) /* Illegal trap. */
  114. #define TARGET_ILL_PRVOPC (5) /* Privileged opcode. */
  115. #define TARGET_ILL_PRVREG (6) /* Privileged register. */
  116. #define TARGET_ILL_COPROC (7) /* Coprocessor error. */
  117. #define TARGET_ILL_BADSTK (8) /* Internal stack error. */
  118. /* SIGSEGV si_codes */
  119. #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
  120. #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
  121. /* SIGTRAP si_codes */
  122. #define TARGET_TRAP_BRKPT (1) /* process beakpoint */
  123. #define TARGET_TRAP_TRACE (2) /* process trace trap */
  124. /* SIGBUS si_codes */
  125. #define TARGET_BUS_ADRALN (1)
  126. #define TARGET_BUS_ADRERR (2)
  127. #define TARGET_BUS_OBJERR (3)
  128. /* SIGFPE codes */
  129. #define TARGET_FPE_INTOVF (1) /* Integer overflow. */
  130. #define TARGET_FPE_INTDIV (2) /* Integer divide by zero. */
  131. #define TARGET_FPE_FLTDIV (3) /* Floating point divide by zero. */
  132. #define TARGET_FPE_FLTOVF (4) /* Floating point overflow. */
  133. #define TARGET_FPE_FLTUND (5) /* Floating point underflow. */
  134. #define TARGET_FPE_FLTRES (6) /* Floating point inexact result. */
  135. #define TARGET_FPE_FLTINV (7) /* Invalid floating point operation. */
  136. #define TARGET_FPE_FLTSUB (8) /* Subscript out of range. */
  137. #endif /* TARGET_OS_SIGINFO_H */