2 * Copyright (c) 1999 Marcel Moolenaar
3 * Copyright (c) 2003 Peter Wemm
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer
11 * in this position and unchanged.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _COMPAT_IA32_IA32_SIGNAL_H
33 #define _COMPAT_IA32_IA32_SIGNAL_H
35 #define _MC_IA32_HASSEGS 0x1
36 #define _MC_IA32_HASBASES 0x2
37 #define _MC_IA32_HASFPXSTATE 0x4
38 #define _MC_IA32_FLAG_MASK \
39 (_MC_IA32_HASSEGS | _MC_IA32_HASBASES | _MC_IA32_HASFPXSTATE)
41 struct ia32_mcontext {
42 u_int32_t mc_onstack; /* XXX - sigcontext compat. */
43 u_int32_t mc_gs; /* machine state (struct trapframe) */
62 u_int32_t mc_len; /* sizeof(struct ia32_mcontext) */
63 /* We use the same values for fpformat and ownedfp */
64 u_int32_t mc_fpformat;
68 * See <i386/include/npx.h> for the internals of mc_fpstate[].
70 u_int32_t mc_fpstate[128] __aligned(16);
73 u_int32_t mc_xfpustate;
74 u_int32_t mc_xfpustate_len;
75 u_int32_t mc_spare2[4];
78 struct ia32_ucontext {
80 struct ia32_mcontext uc_mcontext;
82 struct sigaltstack32 uc_stack;
84 u_int32_t __spare__[4];
88 #if defined(COMPAT_FREEBSD4)
89 struct ia32_mcontext4 {
90 u_int32_t mc_onstack; /* XXX - sigcontext compat. */
91 u_int32_t mc_gs; /* machine state (struct trapframe) */
110 u_int32_t mc_fpregs[28];
111 u_int32_t __spare__[17];
114 struct ia32_ucontext4 {
116 struct ia32_mcontext4 uc_mcontext;
118 struct sigaltstack32 uc_stack;
119 u_int32_t __spare__[8];
124 struct ia32_sigcontext3 {
125 u_int32_t sc_onstack;
150 * Signal frames, arguments passed to application signal handlers.
153 #ifdef COMPAT_FREEBSD4
154 struct ia32_sigframe4 {
156 u_int32_t sf_siginfo; /* code or pointer to sf_si */
157 u_int32_t sf_ucontext; /* points to sf_uc */
158 u_int32_t sf_addr; /* undocumented 4th arg */
159 u_int32_t sf_ah; /* action/handler pointer */
160 struct ia32_ucontext4 sf_uc; /* = *sf_ucontext */
161 struct siginfo32 sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
165 struct ia32_sigframe {
167 u_int32_t sf_siginfo; /* code or pointer to sf_si */
168 u_int32_t sf_ucontext; /* points to sf_uc */
169 u_int32_t sf_addr; /* undocumented 4th arg */
170 u_int32_t sf_ah; /* action/handler pointer */
171 /* Beware, hole due to ucontext being 16 byte aligned! */
172 struct ia32_ucontext sf_uc; /* = *sf_ucontext */
173 struct siginfo32 sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
177 struct ia32_siginfo3 {
178 struct ia32_sigcontext3 si_sc;
181 union sigval32 si_value;
183 struct ia32_sigframe3 {
185 u_int32_t sf_arg2; /* int or siginfo_t */
188 u_int32_t sf_ah; /* action/handler pointer */
189 struct ia32_siginfo3 sf_siginfo;
195 extern char ia32_sigcode[];
196 extern char freebsd4_ia32_sigcode[];
197 extern char ia32_osigcode[];
198 extern char lcall_tramp;
199 extern int sz_ia32_sigcode;
200 extern int sz_freebsd4_ia32_sigcode;
201 extern int sz_ia32_osigcode;
202 extern int sz_lcall_tramp;
203 void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *);
204 void ia32_setregs(struct thread *td, struct image_params *imgp,
206 int setup_lcall_gate(void);