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 20 #ifndef TARGET_OS_SIGINFO_H 21 #define TARGET_OS_SIGINFO_H 22 23 #define TARGET_NSIG 128 24 #define TARGET_NSIG_BPW (sizeof(uint32_t) * 8) 25 #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW) 26 27 /* this struct defines a stack used during syscall handling */ 28 typedef struct target_sigaltstack { 29 abi_long ss_sp; 30 abi_ulong ss_size; 31 abi_long ss_flags; 32 } target_stack_t; 33 34 typedef struct { 35 uint32_t __bits[TARGET_NSIG_WORDS]; 36 } target_sigset_t; 37 38 struct target_sigaction { 39 abi_ulong _sa_handler; 40 int32_t sa_flags; 41 target_sigset_t sa_mask; 42 }; 43 44 typedef union target_sigval { 45 int32_t sival_int; 46 abi_ulong sival_ptr; 47 int32_t sigval_int; 48 abi_ulong sigval_ptr; 49 } target_sigval_t; 50 51 typedef struct target_siginfo { 52 int32_t si_signo; /* signal number */ 53 int32_t si_errno; /* errno association */ 54 int32_t si_code; /* signal code */ 55 int32_t si_pid; /* sending process */ 56 int32_t si_uid; /* sender's ruid */ 57 int32_t si_status; /* exit value */ 58 abi_ulong si_addr; /* faulting instruction */ 59 union target_sigval si_value; /* signal value */ 60 union { 61 struct { 62 int32_t _trapno; /* machine specific trap code */ 63 } _fault; 64 65 /* POSIX.1b timers */ 66 struct { 67 int32_t _timerid; 68 int32_t _overrun; 69 } _timer; 70 71 struct { 72 int32_t _mqd; 73 } _mesgp; 74 75 /* SIGPOLL -- Not really genreated in FreeBSD ??? */ 76 struct { 77 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 78 } _poll; 79 80 struct { 81 int _mqd; 82 } _mesgq; 83 84 struct { 85 /* 86 * Syscall number for signals delivered as a result of system calls 87 * denied by Capsicum. 88 */ 89 int _syscall; 90 } _capsicum; 91 92 /* Spare for future growth */ 93 struct { 94 abi_long __spare1__; 95 int32_t __spare2_[7]; 96 } __spare__; 97 } _reason; 98 } target_siginfo_t; 99 100 struct target_sigevent { 101 abi_int sigev_notify; 102 abi_int sigev_signo; 103 target_sigval_t sigev_value; 104 union { 105 abi_int _threadid; 106 107 /* 108 * The kernel (and thus QEMU) never looks at these; 109 * they're only used as part of the ABI between a 110 * userspace program and libc. 111 */ 112 struct { 113 abi_ulong _function; 114 abi_ulong _attribute; 115 } _sigev_thread; 116 abi_ushort _kevent_flags; 117 abi_long _pad[8]; 118 } _sigev_un; 119 }; 120 121 #define target_si_signo si_signo 122 #define target_si_code si_code 123 #define target_si_errno si_errno 124 #define target_si_addr si_addr 125 126 /* SIGILL si_codes */ 127 #define TARGET_ILL_ILLOPC (1) /* Illegal opcode. */ 128 #define TARGET_ILL_ILLOPN (2) /* Illegal operand. */ 129 #define TARGET_ILL_ILLADR (3) /* Illegal addressing mode. */ 130 #define TARGET_ILL_ILLTRP (4) /* Illegal trap. */ 131 #define TARGET_ILL_PRVOPC (5) /* Privileged opcode. */ 132 #define TARGET_ILL_PRVREG (6) /* Privileged register. */ 133 #define TARGET_ILL_COPROC (7) /* Coprocessor error. */ 134 #define TARGET_ILL_BADSTK (8) /* Internal stack error. */ 135 136 /* SIGSEGV si_codes */ 137 #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ 138 #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ 139 140 /* SIGTRAP si_codes */ 141 #define TARGET_TRAP_BRKPT (1) /* process beakpoint */ 142 #define TARGET_TRAP_TRACE (2) /* process trace trap */ 143 144 /* SIGBUS si_codes */ 145 #define TARGET_BUS_ADRALN (1) 146 #define TARGET_BUS_ADRERR (2) 147 #define TARGET_BUS_OBJERR (3) 148 149 /* SIGFPE codes */ 150 #define TARGET_FPE_INTOVF (1) /* Integer overflow. */ 151 #define TARGET_FPE_INTDIV (2) /* Integer divide by zero. */ 152 #define TARGET_FPE_FLTDIV (3) /* Floating point divide by zero. */ 153 #define TARGET_FPE_FLTOVF (4) /* Floating point overflow. */ 154 #define TARGET_FPE_FLTUND (5) /* Floating point underflow. */ 155 #define TARGET_FPE_FLTRES (6) /* Floating point inexact result. */ 156 #define TARGET_FPE_FLTINV (7) /* Invalid floating point operation. */ 157 #define TARGET_FPE_FLTSUB (8) /* Subscript out of range. */ 158 159 #endif /* TARGET_OS_SIGINFO_H */ 160