/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1999 Marcel Moolenaar4* Copyright (c) 2003 Peter Wemm5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer12* in this position and unchanged.13* 2. Redistributions in binary form must reproduce the above copyright14* notice, this list of conditions and the following disclaimer in the15* documentation and/or other materials provided with the distribution.16* 3. The name of the author may not be used to endorse or promote products17* derived from this software without specific prior written permission.18*19* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR20* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES21* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.22* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,23* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT24* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,25* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY26* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT27* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF28* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.29*/3031#ifndef _COMPAT_IA32_IA32_SIGNAL_H32#define _COMPAT_IA32_IA32_SIGNAL_H3334#include <compat/freebsd32/freebsd32_signal.h>3536#define _MC_IA32_HASSEGS 0x137#define _MC_IA32_HASBASES 0x238#define _MC_IA32_HASFPXSTATE 0x439#define _MC_IA32_FLAG_MASK \40(_MC_IA32_HASSEGS | _MC_IA32_HASBASES | _MC_IA32_HASFPXSTATE)4142struct ia32_mcontext {43uint32_t mc_onstack; /* XXX - sigcontext compat. */44uint32_t mc_gs; /* machine state (struct trapframe) */45uint32_t mc_fs;46uint32_t mc_es;47uint32_t mc_ds;48uint32_t mc_edi;49uint32_t mc_esi;50uint32_t mc_ebp;51uint32_t mc_isp;52uint32_t mc_ebx;53uint32_t mc_edx;54uint32_t mc_ecx;55uint32_t mc_eax;56uint32_t mc_trapno;57uint32_t mc_err;58uint32_t mc_eip;59uint32_t mc_cs;60uint32_t mc_eflags;61uint32_t mc_esp;62uint32_t mc_ss;63uint32_t mc_len; /* sizeof(struct ia32_mcontext) */64/* We use the same values for fpformat and ownedfp */65uint32_t mc_fpformat;66uint32_t mc_ownedfp;67uint32_t mc_flags;68/*69* See <i386/include/npx.h> for the internals of mc_fpstate[].70*/71uint32_t mc_fpstate[128] __aligned(16);72uint32_t mc_fsbase;73uint32_t mc_gsbase;74uint32_t mc_xfpustate;75uint32_t mc_xfpustate_len;76uint32_t mc_spare2[4];77};7879struct ia32_ucontext {80sigset_t uc_sigmask;81struct ia32_mcontext uc_mcontext;82uint32_t uc_link;83struct sigaltstack32 uc_stack;84uint32_t uc_flags;85uint32_t __spare__[4];86};8788struct ia32_freebsd4_mcontext {89uint32_t mc_onstack; /* XXX - sigcontext compat. */90uint32_t mc_gs; /* machine state (struct trapframe) */91uint32_t mc_fs;92uint32_t mc_es;93uint32_t mc_ds;94uint32_t mc_edi;95uint32_t mc_esi;96uint32_t mc_ebp;97uint32_t mc_isp;98uint32_t mc_ebx;99uint32_t mc_edx;100uint32_t mc_ecx;101uint32_t mc_eax;102uint32_t mc_trapno;103uint32_t mc_err;104uint32_t mc_eip;105uint32_t mc_cs;106uint32_t mc_eflags;107uint32_t mc_esp;108uint32_t mc_ss;109uint32_t mc_fpregs[28];110uint32_t __spare__[17];111};112113struct ia32_freebsd4_ucontext {114sigset_t uc_sigmask;115struct ia32_freebsd4_mcontext uc_mcontext;116uint32_t uc_link;117struct sigaltstack32 uc_stack;118uint32_t __spare__[8];119};120121struct ia32_osigcontext {122uint32_t sc_onstack;123uint32_t sc_mask;124uint32_t sc_esp;125uint32_t sc_ebp;126uint32_t sc_isp;127uint32_t sc_eip;128uint32_t sc_eflags;129uint32_t sc_es;130uint32_t sc_ds;131uint32_t sc_cs;132uint32_t sc_ss;133uint32_t sc_edi;134uint32_t sc_esi;135uint32_t sc_ebx;136uint32_t sc_edx;137uint32_t sc_ecx;138uint32_t sc_eax;139uint32_t sc_gs;140uint32_t sc_fs;141uint32_t sc_trapno;142uint32_t sc_err;143};144145/*146* Signal frames, arguments passed to application signal handlers.147*/148149struct ia32_freebsd4_sigframe {150uint32_t sf_signum;151uint32_t sf_siginfo; /* code or pointer to sf_si */152uint32_t sf_ucontext; /* points to sf_uc */153uint32_t sf_addr; /* undocumented 4th arg */154uint32_t sf_ah; /* action/handler pointer */155struct ia32_freebsd4_ucontext sf_uc; /* = *sf_ucontext */156struct __siginfo32 sf_si; /* = *sf_siginfo (SA_SIGINFO case) */157};158159struct ia32_sigframe {160uint32_t sf_signum;161uint32_t sf_siginfo; /* code or pointer to sf_si */162uint32_t sf_ucontext; /* points to sf_uc */163uint32_t sf_addr; /* undocumented 4th arg */164uint32_t sf_ah; /* action/handler pointer */165/* Beware, hole due to ucontext being 16 byte aligned! */166struct ia32_ucontext sf_uc; /* = *sf_ucontext */167struct __siginfo32 sf_si; /* = *sf_siginfo (SA_SIGINFO case) */168};169170struct ia32_osiginfo {171struct ia32_osigcontext si_sc;172int si_signo;173int si_code;174union sigval32 si_value;175};176struct ia32_osigframe {177int sf_signum;178uint32_t sf_arg2; /* int or siginfo_t */179uint32_t sf_scp;180uint32_t sf_addr;181uint32_t sf_ah; /* action/handler pointer */182struct ia32_osiginfo sf_siginfo;183};184185struct ksiginfo;186struct image_params;187void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *);188void ia32_setregs(struct thread *td, struct image_params *imgp,189uintptr_t stack);190int setup_lcall_gate(void);191192#endif193194195