]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - sys/compat/ia32/ia32_signal.h
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / sys / compat / ia32 / ia32_signal.h
1 /*-
2  * Copyright (c) 1999 Marcel Moolenaar
3  * Copyright (c) 2003 Peter Wemm
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
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.
17  *
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.
28  *
29  * $FreeBSD$
30  */
31
32 struct ia32_mcontext {
33         u_int32_t       mc_onstack;             /* XXX - sigcontext compat. */
34         u_int32_t       mc_gs;                  /* machine state (struct trapframe) */
35         u_int32_t       mc_fs;
36         u_int32_t       mc_es;
37         u_int32_t       mc_ds;
38         u_int32_t       mc_edi;
39         u_int32_t       mc_esi;
40         u_int32_t       mc_ebp;
41         u_int32_t       mc_isp;
42         u_int32_t       mc_ebx;
43         u_int32_t       mc_edx;
44         u_int32_t       mc_ecx;
45         u_int32_t       mc_eax;
46         u_int32_t       mc_trapno;
47         u_int32_t       mc_err;
48         u_int32_t       mc_eip;
49         u_int32_t       mc_cs;
50         u_int32_t       mc_eflags;
51         u_int32_t       mc_esp;
52         u_int32_t       mc_ss;
53         u_int32_t       mc_len;                 /* sizeof(struct ia32_mcontext) */
54         /* We use the same values for fpformat and ownedfp */
55         u_int32_t       mc_fpformat;
56         u_int32_t       mc_ownedfp;
57         u_int32_t       mc_spare1[1];           /* align next field to 16 bytes */
58         /*
59          * See <i386/include/npx.h> for the internals of mc_fpstate[].
60          */
61         u_int32_t       mc_fpstate[128] __aligned(16);
62         u_int32_t       mc_spare2[8];
63 };
64
65 struct ia32_ucontext {
66         sigset_t                uc_sigmask;
67         struct ia32_mcontext    uc_mcontext;
68         u_int32_t               uc_link;
69         struct sigaltstack32    uc_stack;
70         u_int32_t               uc_flags;
71         u_int32_t               __spare__[4];
72 };
73
74
75 #if defined(COMPAT_FREEBSD4)
76 struct ia32_mcontext4 {
77         u_int32_t       mc_onstack;             /* XXX - sigcontext compat. */
78         u_int32_t       mc_gs;                  /* machine state (struct trapframe) */
79         u_int32_t       mc_fs;
80         u_int32_t       mc_es;
81         u_int32_t       mc_ds;
82         u_int32_t       mc_edi;
83         u_int32_t       mc_esi;
84         u_int32_t       mc_ebp;
85         u_int32_t       mc_isp;
86         u_int32_t       mc_ebx;
87         u_int32_t       mc_edx;
88         u_int32_t       mc_ecx;
89         u_int32_t       mc_eax;
90         u_int32_t       mc_trapno;
91         u_int32_t       mc_err;
92         u_int32_t       mc_eip;
93         u_int32_t       mc_cs;
94         u_int32_t       mc_eflags;
95         u_int32_t       mc_esp; 
96         u_int32_t       mc_ss;
97         u_int32_t       mc_fpregs[28];
98         u_int32_t       __spare__[17];
99 };
100
101 struct ia32_ucontext4 {
102         sigset_t                uc_sigmask;
103         struct ia32_mcontext4   uc_mcontext;
104         u_int32_t               uc_link;
105         struct sigaltstack32    uc_stack;
106         u_int32_t               __spare__[8];
107 };
108 #endif
109
110 #ifdef COMPAT_FREEBSD3
111 struct ia32_sigcontext3 {
112         u_int32_t       sc_onstack;
113         u_int32_t       sc_mask;
114         u_int32_t       sc_esp; 
115         u_int32_t       sc_ebp;
116         u_int32_t       sc_isp;
117         u_int32_t       sc_eip;
118         u_int32_t       sc_eflags;
119         u_int32_t       sc_es;
120         u_int32_t       sc_ds;
121         u_int32_t       sc_cs;
122         u_int32_t       sc_ss;
123         u_int32_t       sc_edi;
124         u_int32_t       sc_esi;
125         u_int32_t       sc_ebx;
126         u_int32_t       sc_edx;
127         u_int32_t       sc_ecx;
128         u_int32_t       sc_eax;
129         u_int32_t       sc_gs;
130         u_int32_t       sc_fs;
131         u_int32_t       sc_trapno;
132         u_int32_t       sc_err;
133 };
134 #endif
135
136 /*
137  * Signal frames, arguments passed to application signal handlers.
138  */
139
140 #ifdef COMPAT_FREEBSD4
141 struct ia32_sigframe4 {
142         u_int32_t               sf_signum;
143         u_int32_t               sf_siginfo;     /* code or pointer to sf_si */
144         u_int32_t               sf_ucontext;    /* points to sf_uc */
145         u_int32_t               sf_addr;        /* undocumented 4th arg */
146         u_int32_t               sf_ah;          /* action/handler pointer */
147         struct ia32_ucontext4   sf_uc;          /* = *sf_ucontext */
148         struct siginfo32        sf_si;          /* = *sf_siginfo (SA_SIGINFO case) */
149 };
150 #endif
151
152 struct ia32_sigframe {
153         u_int32_t               sf_signum;
154         u_int32_t               sf_siginfo;     /* code or pointer to sf_si */
155         u_int32_t               sf_ucontext;    /* points to sf_uc */
156         u_int32_t               sf_addr;        /* undocumented 4th arg */
157         u_int32_t               sf_ah;          /* action/handler pointer */
158         /* Beware, hole due to ucontext being 16 byte aligned! */
159         struct ia32_ucontext    sf_uc;          /* = *sf_ucontext */
160         struct siginfo32        sf_si;          /* = *sf_siginfo (SA_SIGINFO case) */
161 };
162
163 #ifdef COMPAT_FREEBSD3
164 struct ia32_siginfo3 {
165         struct ia32_sigcontext3 si_sc;
166         int                     si_signo;
167         int                     si_code;
168         union sigval32          si_value;
169 };
170 struct ia32_sigframe3 {
171         int                     sf_signum;
172         u_int32_t               sf_arg2;        /* int or siginfo_t */
173         u_int32_t               sf_scp;
174         u_int32_t               sf_addr;
175         u_int32_t               sf_ah;          /* action/handler pointer */
176         struct ia32_siginfo3    sf_siginfo;
177 };
178 #endif
179
180 struct ksiginfo;
181 extern char ia32_sigcode[];
182 extern char freebsd4_ia32_sigcode[];
183 extern int sz_ia32_sigcode;
184 extern int sz_freebsd4_ia32_sigcode;
185 extern void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *);
186 extern void ia32_setregs(struct thread *td, u_long entry, u_long stack,
187     u_long ps_strings);