1*4a5d661aSToomas Soome /*- 2*4a5d661aSToomas Soome * Copyright (c) 1986, 1989, 1991, 1993 3*4a5d661aSToomas Soome * The Regents of the University of California. All rights reserved. 4*4a5d661aSToomas Soome * Copyright (c) 2003 Peter Wemm. 5*4a5d661aSToomas Soome * 6*4a5d661aSToomas Soome * Redistribution and use in source and binary forms, with or without 7*4a5d661aSToomas Soome * modification, are permitted provided that the following conditions 8*4a5d661aSToomas Soome * are met: 9*4a5d661aSToomas Soome * 1. Redistributions of source code must retain the above copyright 10*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer. 11*4a5d661aSToomas Soome * 2. Redistributions in binary form must reproduce the above copyright 12*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer in the 13*4a5d661aSToomas Soome * documentation and/or other materials provided with the distribution. 14*4a5d661aSToomas Soome * 4. Neither the name of the University nor the names of its contributors 15*4a5d661aSToomas Soome * may be used to endorse or promote products derived from this software 16*4a5d661aSToomas Soome * without specific prior written permission. 17*4a5d661aSToomas Soome * 18*4a5d661aSToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19*4a5d661aSToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*4a5d661aSToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*4a5d661aSToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22*4a5d661aSToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23*4a5d661aSToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24*4a5d661aSToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25*4a5d661aSToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26*4a5d661aSToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27*4a5d661aSToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28*4a5d661aSToomas Soome * SUCH DAMAGE. 29*4a5d661aSToomas Soome * 30*4a5d661aSToomas Soome * @(#)signal.h 8.1 (Berkeley) 6/11/93 31*4a5d661aSToomas Soome * $FreeBSD$ 32*4a5d661aSToomas Soome */ 33*4a5d661aSToomas Soome 34*4a5d661aSToomas Soome #ifndef _X86_SIGNAL_H 35*4a5d661aSToomas Soome #define _X86_SIGNAL_H 1 36*4a5d661aSToomas Soome 37*4a5d661aSToomas Soome /* 38*4a5d661aSToomas Soome * Machine-dependent signal definitions 39*4a5d661aSToomas Soome */ 40*4a5d661aSToomas Soome 41*4a5d661aSToomas Soome #include <sys/cdefs.h> 42*4a5d661aSToomas Soome #include <sys/_sigset.h> 43*4a5d661aSToomas Soome 44*4a5d661aSToomas Soome #if __BSD_VISIBLE 45*4a5d661aSToomas Soome #include <machine/trap.h> /* codes for SIGILL, SIGFPE */ 46*4a5d661aSToomas Soome #endif 47*4a5d661aSToomas Soome 48*4a5d661aSToomas Soome #ifdef __i386__ 49*4a5d661aSToomas Soome typedef int sig_atomic_t; 50*4a5d661aSToomas Soome 51*4a5d661aSToomas Soome #if __BSD_VISIBLE 52*4a5d661aSToomas Soome struct sigcontext { 53*4a5d661aSToomas Soome struct __sigset sc_mask; /* signal mask to restore */ 54*4a5d661aSToomas Soome int sc_onstack; /* sigstack state to restore */ 55*4a5d661aSToomas Soome int sc_gs; /* machine state (struct trapframe) */ 56*4a5d661aSToomas Soome int sc_fs; 57*4a5d661aSToomas Soome int sc_es; 58*4a5d661aSToomas Soome int sc_ds; 59*4a5d661aSToomas Soome int sc_edi; 60*4a5d661aSToomas Soome int sc_esi; 61*4a5d661aSToomas Soome int sc_ebp; 62*4a5d661aSToomas Soome int sc_isp; 63*4a5d661aSToomas Soome int sc_ebx; 64*4a5d661aSToomas Soome int sc_edx; 65*4a5d661aSToomas Soome int sc_ecx; 66*4a5d661aSToomas Soome int sc_eax; 67*4a5d661aSToomas Soome int sc_trapno; 68*4a5d661aSToomas Soome int sc_err; 69*4a5d661aSToomas Soome int sc_eip; 70*4a5d661aSToomas Soome int sc_cs; 71*4a5d661aSToomas Soome int sc_efl; 72*4a5d661aSToomas Soome int sc_esp; 73*4a5d661aSToomas Soome int sc_ss; 74*4a5d661aSToomas Soome int sc_len; /* sizeof(mcontext_t) */ 75*4a5d661aSToomas Soome /* 76*4a5d661aSToomas Soome * See <machine/ucontext.h> and <machine/npx.h> for 77*4a5d661aSToomas Soome * the following fields. 78*4a5d661aSToomas Soome */ 79*4a5d661aSToomas Soome int sc_fpformat; 80*4a5d661aSToomas Soome int sc_ownedfp; 81*4a5d661aSToomas Soome int sc_flags; 82*4a5d661aSToomas Soome int sc_fpstate[128] __aligned(16); 83*4a5d661aSToomas Soome 84*4a5d661aSToomas Soome int sc_fsbase; 85*4a5d661aSToomas Soome int sc_gsbase; 86*4a5d661aSToomas Soome 87*4a5d661aSToomas Soome int sc_xfpustate; 88*4a5d661aSToomas Soome int sc_xfpustate_len; 89*4a5d661aSToomas Soome 90*4a5d661aSToomas Soome int sc_spare2[4]; 91*4a5d661aSToomas Soome }; 92*4a5d661aSToomas Soome 93*4a5d661aSToomas Soome #define sc_sp sc_esp 94*4a5d661aSToomas Soome #define sc_fp sc_ebp 95*4a5d661aSToomas Soome #define sc_pc sc_eip 96*4a5d661aSToomas Soome #define sc_ps sc_efl 97*4a5d661aSToomas Soome #define sc_eflags sc_efl 98*4a5d661aSToomas Soome 99*4a5d661aSToomas Soome #endif /* __BSD_VISIBLE */ 100*4a5d661aSToomas Soome #endif /* __i386__ */ 101*4a5d661aSToomas Soome 102*4a5d661aSToomas Soome #ifdef __amd64__ 103*4a5d661aSToomas Soome typedef long sig_atomic_t; 104*4a5d661aSToomas Soome 105*4a5d661aSToomas Soome #if __BSD_VISIBLE 106*4a5d661aSToomas Soome /* 107*4a5d661aSToomas Soome * Information pushed on stack when a signal is delivered. 108*4a5d661aSToomas Soome * This is used by the kernel to restore state following 109*4a5d661aSToomas Soome * execution of the signal handler. It is also made available 110*4a5d661aSToomas Soome * to the handler to allow it to restore state properly if 111*4a5d661aSToomas Soome * a non-standard exit is performed. 112*4a5d661aSToomas Soome * 113*4a5d661aSToomas Soome * The sequence of the fields/registers after sc_mask in struct 114*4a5d661aSToomas Soome * sigcontext must match those in mcontext_t and struct trapframe. 115*4a5d661aSToomas Soome */ 116*4a5d661aSToomas Soome struct sigcontext { 117*4a5d661aSToomas Soome struct __sigset sc_mask; /* signal mask to restore */ 118*4a5d661aSToomas Soome long sc_onstack; /* sigstack state to restore */ 119*4a5d661aSToomas Soome long sc_rdi; /* machine state (struct trapframe) */ 120*4a5d661aSToomas Soome long sc_rsi; 121*4a5d661aSToomas Soome long sc_rdx; 122*4a5d661aSToomas Soome long sc_rcx; 123*4a5d661aSToomas Soome long sc_r8; 124*4a5d661aSToomas Soome long sc_r9; 125*4a5d661aSToomas Soome long sc_rax; 126*4a5d661aSToomas Soome long sc_rbx; 127*4a5d661aSToomas Soome long sc_rbp; 128*4a5d661aSToomas Soome long sc_r10; 129*4a5d661aSToomas Soome long sc_r11; 130*4a5d661aSToomas Soome long sc_r12; 131*4a5d661aSToomas Soome long sc_r13; 132*4a5d661aSToomas Soome long sc_r14; 133*4a5d661aSToomas Soome long sc_r15; 134*4a5d661aSToomas Soome int sc_trapno; 135*4a5d661aSToomas Soome short sc_fs; 136*4a5d661aSToomas Soome short sc_gs; 137*4a5d661aSToomas Soome long sc_addr; 138*4a5d661aSToomas Soome int sc_flags; 139*4a5d661aSToomas Soome short sc_es; 140*4a5d661aSToomas Soome short sc_ds; 141*4a5d661aSToomas Soome long sc_err; 142*4a5d661aSToomas Soome long sc_rip; 143*4a5d661aSToomas Soome long sc_cs; 144*4a5d661aSToomas Soome long sc_rflags; 145*4a5d661aSToomas Soome long sc_rsp; 146*4a5d661aSToomas Soome long sc_ss; 147*4a5d661aSToomas Soome long sc_len; /* sizeof(mcontext_t) */ 148*4a5d661aSToomas Soome /* 149*4a5d661aSToomas Soome * See <machine/ucontext.h> and <machine/fpu.h> for the following 150*4a5d661aSToomas Soome * fields. 151*4a5d661aSToomas Soome */ 152*4a5d661aSToomas Soome long sc_fpformat; 153*4a5d661aSToomas Soome long sc_ownedfp; 154*4a5d661aSToomas Soome long sc_fpstate[64] __aligned(16); 155*4a5d661aSToomas Soome 156*4a5d661aSToomas Soome long sc_fsbase; 157*4a5d661aSToomas Soome long sc_gsbase; 158*4a5d661aSToomas Soome 159*4a5d661aSToomas Soome long sc_xfpustate; 160*4a5d661aSToomas Soome long sc_xfpustate_len; 161*4a5d661aSToomas Soome 162*4a5d661aSToomas Soome long sc_spare[4]; 163*4a5d661aSToomas Soome }; 164*4a5d661aSToomas Soome #endif /* __BSD_VISIBLE */ 165*4a5d661aSToomas Soome #endif /* __amd64__ */ 166*4a5d661aSToomas Soome 167*4a5d661aSToomas Soome #endif 168