Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / compat / irix / irix_signal.h
blobce0be9494749545df8baf72f6bedefdc23bfa02a
1 /* $NetBSD: irix_signal.h,v 1.17 2007/12/04 18:40:12 dsl Exp $ */
3 /*-
4 * Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _IRIX_SIGNAL_H_
33 #define _IRIX_SIGNAL_H_
35 #include <sys/types.h>
36 #include <sys/signal.h>
38 #include <machine/svr4_machdep.h>
40 #include <compat/irix/irix_types.h>
42 /* From IRIX's <sys/signal.h> */
44 #define IRIX_SIG_SETMASK32 256
46 typedef struct irix_sigcontext {
47 __uint32_t isc_regmask;
48 __uint32_t isc_status;
49 __uint64_t isc_pc;
50 __uint64_t isc_regs[32];
51 __uint64_t isc_fpregs[32];
52 __uint32_t isc_ownedfp;
53 __uint32_t isc_fpc_csr;
54 __uint32_t isc_fpc_eir;
55 __uint32_t isc_ssflags;
56 __uint64_t isc_mdhi;
57 __uint64_t isc_mdlo;
58 __uint64_t isc_cause;
59 __uint64_t isc_badvaddr;
60 __uint64_t isc_triggersave;
61 irix_sigset_t isc_sigset;
62 __uint64_t isc_fp_rounded_result;
63 __uint64_t isc_pad[31];
64 } irix_sigcontext_t;
66 #define IRIX_SS_ONSTACK 0x00000001
67 #define IRIX_SS_DISABLE 0x00000002
69 /* From IRIX's <sys/ucontext.h> */
70 #define IRIX_UC_SIGMASK 001
71 #define IRIX_UC_STACK 002
72 #define IRIX_UC_CPU 004
73 #define IRIX_UC_MAU 010
74 #define IRIX_UC_MCONTEXT (IRIX_UC_CPU|IRIX_UC_MAU)
75 #define IRIX_UC_ALL (IRIX_UC_SIGMASK|IRIX_UC_STACK|IRIX_UC_MCONTEXT)
77 #define IRIX_CTX_MDLO 32
78 #define IRIX_CTX_MDHI 33
79 #define IRIX_CTX_CAUSE 34
80 #define IRIX_CTX_EPC 35
82 #if 1 /* _MIPS_SZLONG == 32 */
83 typedef struct irix__sigaltstack {
84 void *ss_sp;
85 irix_size_t ss_size;
86 int ss_flags;
87 } irix_stack_t;
88 #endif
89 #if 0 /* _MIPS_SZLONG == 64 */
90 typedef struct irix__sigaltstack {
91 void *ss_sp;
92 __uint32_t ss_size;
93 int ss_flags;
94 } irix_stack_t;
95 #endif
97 typedef struct irix_ucontext {
98 unsigned long iuc_flags;
99 struct irix_ucontext *iuc_link;
100 irix_sigset_t iuc_sigmask;
101 irix_stack_t iuc_stack;
102 svr4_mcontext_t iuc_mcontext;
103 long iuc_filler[47];
104 int iuc_triggersave;
105 } irix_ucontext_t;
107 /* From IRIX's <sys/siginfo.h> */
108 #define IRIX_ILL_ILLOPC 1
109 #define IRIX_ILL_ILLOPN 2
110 #define IRIX_ILL_ILLADR 3
111 #define IRIX_ILL_ILLTRP 4
112 #define IRIX_ILL_PRVOPC 5
113 #define IRIX_ILL_PRVREG 6
114 #define IRIX_ILL_COPROC 7
115 #define IRIX_ILL_BADSTK 8
117 #define IRIX_FPE_INTDIV 1
118 #define IRIX_FPE_INTOVF 2
119 #define IRIX_FPE_FLTDIV 3
120 #define IRIX_FPE_FLTOVF 4
121 #define IRIX_FPE_FLTUND 5
122 #define IRIX_FPE_FLTRES 6
123 #define IRIX_FPE_FLTINV 7
124 #define IRIX_FPE_FLTSUB 8
126 #define IRIX_SEGV_MAPERR 1
127 #define IRIX_SEGV_ACCERR 2
129 #define IRIX_BUS_ADRALN 1
130 #define IRIX_BUS_ADRERR 2
131 #define IRIX_BUS_OBJERR 3
133 #define IRIX_TRAP_BRKPT 1
134 #define IRIX_TRAP_TRACE 2
136 #define IRIX_CLD_EXITED 1
137 #define IRIX_CLD_KILLED 2
138 #define IRIX_CLD_DUMPED 3
139 #define IRIX_CLD_TRAPPED 4
140 #define IRIX_CLD_STOPPED 5
141 #define IRIX_CLD_CONTINUED 6
143 #define IRIX_POLL_IN 1
144 #define IRIX_POLL_OUT 2
145 #define IRIX_POLL_MSG 3
146 #define IRIX_POLL_ERR 4
147 #define IRIX_POLL_PRI 5
148 #define IRIX_POLL_HUP 6
150 #define IRIX_UME_ECCERR 1
152 /* From IRIX's <sys/fault.h> */
153 #define IRIX_FLTILL 1
154 #define IRIX_FLTPRIV 2
155 #define IRIX_FLTBPT 3
156 #define IRIX_FLTTRACE 4
157 #define IRIX_FLTACCESS 5
158 #define IRIX_FLTBOUNDS 6
159 #define IRIX_FLTIOVF 7
160 #define IRIX_FLTIZDIV 8
161 #define IRIX_FLTFPE 9
162 #define IRIX_FLTSTACK 10
163 #define IRIX_FLTPAGE 11
164 #define IRIX_FLTPCINVAL 12
165 #define IRIX_FLTWATCH 13
166 #define IRIX_FLTKWATCH 14
167 #define IRIX_FLTSCWATCH 15
170 #define IRIX_SI_MAXSZ 128
171 #define IRIX_SI_PAD ((IRIX_SI_MAXSZ / sizeof(__int32_t)) - 3)
173 /* From IRIX's <sys/ksignal.h> */
174 typedef union irix_irix5_sigval {
175 irix_app32_int_t sigbval_int;
176 irix_app32_ptr_t sival_ptr;
177 } irix_irix5_sigval_t;
179 typedef struct irix_irix5_siginfo {
180 irix_app32_int_t isi_signo;
181 irix_app32_int_t isi_code;
182 irix_app32_int_t isi_errno;
183 union {
184 irix_app32_int_t si_pad[IRIX_SI_PAD];
185 struct {
186 irix_irix5_pid_t __pid;
187 union {
188 struct {
189 irix_irix5_uid_t __uid;
190 } __kill;
191 struct {
192 irix_irix5_clock_t __utime;
193 irix_app32_int_t __status;
194 irix_irix5_clock_t __stime;
195 irix_app32_int_t __swap;
196 } __cld;
197 } __pdata;
198 } __proc;
199 struct {
200 irix_app32_ptr_t __addr;
201 } __fault;
202 struct {
203 irix_app32_int_t __fd;
204 irix_app32_long_t __band;
205 } __file;
206 union irix_irix5_sigval __value;
207 } __data;
208 } irix_irix5_siginfo_t;
210 #define isi_pid __data.__proc.__pid
211 #define isi_stime __data.__proc.__pdata.__cld.__stime
212 #define isi_utime __data.__proc.__pdata.__cld.__utime
213 #define isi_status __data.__proc.__pdata.__cld.__status
214 #define isi_addr __data.__fault.__addr
215 #define isi_trap
218 * This is the signal frame, as seen by the signal handler. The
219 * kernel only sets up isf_ctx, the signal trampoline does the
220 * other fields.
222 struct irix_sigframe {
223 int isf_pad1[7];
224 int *isf_uep; /* Pointer to errno in userspace */
225 int isf_errno;
226 int isf_signo;
227 struct irix_sigcontext *isf_scp;
228 struct irix_ucontext *isf_ucp;
229 union {
230 struct irix_sigcontext isc;
231 struct irix_sigcontext_siginfo {
232 struct irix_ucontext iuc;
233 struct irix_irix5_siginfo iis;
234 } iss;
235 } isf_ctx;
239 #ifdef _KERNEL
240 __BEGIN_DECLS
241 void native_to_irix_sigset(const sigset_t *, irix_sigset_t *);
242 void irix_to_native_sigset(const irix_sigset_t *, sigset_t *);
245 void irix_sendsig(const ksiginfo_t *, const sigset_t *);
246 __END_DECLS
247 #endif /* _KERNEL */
250 #endif /* _IRIX_SIGNAL_H_ */