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