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