1 | /* $NetBSD: linux32_signal.h,v 1.4 2015/03/08 17:10:44 christos Exp $ */ |
2 | |
3 | /*- |
4 | * Copyright (c) 2006 Emmanuel Dreyfus, 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 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
14 | * 3. All advertising materials mentioning features or use of this software |
15 | * must display the following acknowledgement: |
16 | * This product includes software developed by Emmanuel Dreyfus |
17 | * 4. The name of the author may not be used to endorse or promote |
18 | * products derived from this software without specific prior written |
19 | * permission. |
20 | * |
21 | * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS'' |
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
23 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
31 | * POSSIBILITY OF SUCH DAMAGE. |
32 | */ |
33 | #ifndef _AMD64_LINUX32_SIGNAL_H_ |
34 | #define _AMD64_LINUX32_SIGNAL_H_ |
35 | |
36 | #define native_to_linux32_signo native_to_linux_signo |
37 | #define linux32_to_native_signo linux_to_native_signo |
38 | |
39 | typedef netbsd32_pointer_t linux32_handlerp_t; |
40 | typedef netbsd32_pointer_t linux32_restorer_t; |
41 | typedef netbsd32_pointer_t linux32_siginfop_t; |
42 | typedef netbsd32_pointer_t linux32_ucontextp_t; |
43 | typedef netbsd32_pointer_t linux32_sigcontextp_t; |
44 | typedef netbsd32_pointer_t linux32_fpstatep_t; |
45 | typedef u_int32_t linux32_old_sigset_t; |
46 | |
47 | #define LINUX32__NSIG 64 |
48 | #define LINUX32__NSIG_BPW 32 |
49 | #define LINUX32__NSIG_WORDS (LINUX32__NSIG / LINUX32__NSIG_BPW) |
50 | |
51 | #define LINUX32_SIG_BLOCK 0 |
52 | #define LINUX32_SIG_UNBLOCK 1 |
53 | #define LINUX32_SIG_SETMASK 2 |
54 | |
55 | #define LINUX32_SA_NOCLDSTOP 0x00000001 |
56 | #define LINUX32_SA_NOCLDWAIT 0x00000002 |
57 | #define LINUX32_SA_SIGINFO 0x00000004 |
58 | #define LINUX32_SA_RESTORER 0x04000000 |
59 | #define LINUX32_SA_ONSTACK 0x08000000 |
60 | #define LINUX32_SA_RESTART 0x10000000 |
61 | #define LINUX32_SA_INTERRUPT 0x20000000 |
62 | #define LINUX32_SA_NOMASK 0x40000000 |
63 | #define LINUX32_SA_ONESHOT 0x80000000 |
64 | #define LINUX32_SA_ALLBITS 0xfc000007 |
65 | |
66 | #define LINUX32_SS_ONSTACK 1 |
67 | #define LINUX32_SS_DISABLE 2 |
68 | |
69 | /* |
70 | * We only define the ones used in linux32_machdep.c, since they are |
71 | * the same on i386 and amd64... |
72 | */ |
73 | #define LINUX32_SIGILL LINUX_SIGILL |
74 | #define LINUX32_SIGFPE LINUX_SIGFPE |
75 | #define LINUX32_SIGSEGV LINUX_SIGSEGV |
76 | #define LINUX32_SIGBUS LINUX_SIGBUS |
77 | #define LINUX32_SIGTRAP LINUX_SIGTRAP |
78 | #define LINUX32_SIGCHLD LINUX_SIGCHLD |
79 | #define LINUX32_SIGIO LINUX_SIGIO |
80 | #define LINUX32_SIGALRM LINUX_SIGALRM |
81 | #define LINUX32_SIGRTMIN LINUX_SIGRTMIN |
82 | |
83 | typedef struct { |
84 | u_int32_t sig[LINUX32__NSIG_WORDS]; |
85 | } linux32_sigset_t; |
86 | |
87 | struct linux32_sigaction { |
88 | linux32_handlerp_t linux_sa_handler; |
89 | u_int32_t linux_sa_flags; |
90 | linux32_restorer_t linux_sa_restorer; |
91 | linux32_sigset_t linux_sa_mask; |
92 | }; |
93 | |
94 | |
95 | struct linux32_sigaltstack { |
96 | netbsd32_voidp ss_sp; |
97 | int ss_flags; |
98 | netbsd32_size_t ss_size; |
99 | }; |
100 | |
101 | struct linux32_sigcontext { |
102 | int sc_gs; |
103 | int sc_fs; |
104 | int sc_es; |
105 | int sc_ds; |
106 | int sc_edi; |
107 | int sc_esi; |
108 | int sc_ebp; |
109 | int sc_esp; |
110 | int sc_ebx; |
111 | int sc_edx; |
112 | int sc_ecx; |
113 | int sc_eax; |
114 | int sc_trapno; |
115 | int sc_err; |
116 | int sc_eip; |
117 | int sc_cs; |
118 | int sc_eflags; |
119 | int sc_esp_at_signal; |
120 | int sc_ss; |
121 | linux32_fpstatep_t sc_387; |
122 | /* XXX check this */ |
123 | linux32_old_sigset_t sc_mask; |
124 | int sc_cr2; |
125 | }; |
126 | |
127 | struct linux32_libc_fpreg { |
128 | unsigned short significand[4]; |
129 | unsigned short exponent; |
130 | }; |
131 | |
132 | struct linux32_libc_fpstate { |
133 | u_int32_t cw; |
134 | u_int32_t sw; |
135 | u_int32_t tag; |
136 | u_int32_t ipoff; |
137 | u_int32_t cssel; |
138 | u_int32_t dataoff; |
139 | u_int32_t datasel; |
140 | struct linux32_libc_fpreg _st[8]; |
141 | u_int32_t status; |
142 | }; |
143 | |
144 | struct linux32_ucontext { |
145 | u_int32_t uc_flags; |
146 | linux32_ucontextp_t uc_link; |
147 | struct linux32_sigaltstack uc_stack; |
148 | struct linux32_sigcontext uc_mcontext; |
149 | linux32_sigset_t uc_sigmask; |
150 | struct linux32_libc_fpstate uc_fpregs_mem; |
151 | }; |
152 | |
153 | struct linux32_rt_sigframe { |
154 | int sf_sig; |
155 | linux32_siginfop_t sf_sip; |
156 | linux32_ucontextp_t sf_ucp; |
157 | struct linux32_siginfo sf_si; |
158 | struct linux32_ucontext sf_uc; |
159 | linux32_handlerp_t sf_handler; |
160 | }; |
161 | |
162 | struct linux32_sigframe { |
163 | int sf_sig; |
164 | struct linux32_sigcontext sf_sc; |
165 | linux32_handlerp_t sf_handler; |
166 | }; |
167 | |
168 | #endif /* _AMD64_LINUX32_SIGNAL_H_ */ |
169 | |