1#ifndef _ASM_X86_SIGNAL_H
2#define _ASM_X86_SIGNAL_H
3
4#ifndef __ASSEMBLY__
5#include <linux/types.h>
6#include <linux/time.h>
7#include <linux/compiler.h>
8
9
10struct siginfo;
11
12#ifdef __KERNEL__
13#include <linux/linkage.h>
14
15
16
17
18#define _NSIG 64
19
20#ifdef __i386__
21# define _NSIG_BPW 32
22#else
23# define _NSIG_BPW 64
24#endif
25
26#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
27
28typedef unsigned long old_sigset_t;
29
30typedef struct {
31 unsigned long sig[_NSIG_WORDS];
32} sigset_t;
33
34#else
35
36
37#define NSIG 32
38typedef unsigned long sigset_t;
39
40#endif
41#endif
42
43#define SIGHUP 1
44#define SIGINT 2
45#define SIGQUIT 3
46#define SIGILL 4
47#define SIGTRAP 5
48#define SIGABRT 6
49#define SIGIOT 6
50#define SIGBUS 7
51#define SIGFPE 8
52#define SIGKILL 9
53#define SIGUSR1 10
54#define SIGSEGV 11
55#define SIGUSR2 12
56#define SIGPIPE 13
57#define SIGALRM 14
58#define SIGTERM 15
59#define SIGSTKFLT 16
60#define SIGCHLD 17
61#define SIGCONT 18
62#define SIGSTOP 19
63#define SIGTSTP 20
64#define SIGTTIN 21
65#define SIGTTOU 22
66#define SIGURG 23
67#define SIGXCPU 24
68#define SIGXFSZ 25
69#define SIGVTALRM 26
70#define SIGPROF 27
71#define SIGWINCH 28
72#define SIGIO 29
73#define SIGPOLL SIGIO
74
75
76
77#define SIGPWR 30
78#define SIGSYS 31
79#define SIGUNUSED 31
80
81
82#define SIGRTMIN 32
83#define SIGRTMAX _NSIG
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98#define SA_NOCLDSTOP 0x00000001u
99#define SA_NOCLDWAIT 0x00000002u
100#define SA_SIGINFO 0x00000004u
101#define SA_ONSTACK 0x08000000u
102#define SA_RESTART 0x10000000u
103#define SA_NODEFER 0x40000000u
104#define SA_RESETHAND 0x80000000u
105
106#define SA_NOMASK SA_NODEFER
107#define SA_ONESHOT SA_RESETHAND
108
109#define SA_RESTORER 0x04000000
110
111
112
113
114#define SS_ONSTACK 1
115#define SS_DISABLE 2
116
117#define MINSIGSTKSZ 2048
118#define SIGSTKSZ 8192
119
120#include <asm-generic/signal-defs.h>
121
122#ifndef __ASSEMBLY__
123
124# ifdef __KERNEL__
125extern void do_notify_resume(struct pt_regs *, void *, __u32);
126# endif
127
128#ifdef __i386__
129# ifdef __KERNEL__
130struct old_sigaction {
131 __sighandler_t sa_handler;
132 old_sigset_t sa_mask;
133 unsigned long sa_flags;
134 __sigrestore_t sa_restorer;
135};
136
137struct sigaction {
138 __sighandler_t sa_handler;
139 unsigned long sa_flags;
140 __sigrestore_t sa_restorer;
141 sigset_t sa_mask;
142};
143
144struct k_sigaction {
145 struct sigaction sa;
146};
147
148# else
149
150
151struct sigaction {
152 union {
153 __sighandler_t _sa_handler;
154 void (*_sa_sigaction)(int, struct siginfo *, void *);
155 } _u;
156 sigset_t sa_mask;
157 unsigned long sa_flags;
158 void (*sa_restorer)(void);
159};
160
161#define sa_handler _u._sa_handler
162#define sa_sigaction _u._sa_sigaction
163
164# endif
165#else
166
167struct sigaction {
168 __sighandler_t sa_handler;
169 unsigned long sa_flags;
170 __sigrestore_t sa_restorer;
171 sigset_t sa_mask;
172};
173
174struct k_sigaction {
175 struct sigaction sa;
176};
177
178#endif
179
180typedef struct sigaltstack {
181 void __user *ss_sp;
182 int ss_flags;
183 size_t ss_size;
184} stack_t;
185
186#ifdef __KERNEL__
187#include <asm/sigcontext.h>
188
189#ifdef __i386__
190
191#define __HAVE_ARCH_SIG_BITOPS
192
193#define sigaddset(set,sig) \
194 (__builtin_constant_p(sig) \
195 ? __const_sigaddset((set), (sig)) \
196 : __gen_sigaddset((set), (sig)))
197
198static inline void __gen_sigaddset(sigset_t *set, int _sig)
199{
200 asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
201}
202
203static inline void __const_sigaddset(sigset_t *set, int _sig)
204{
205 unsigned long sig = _sig - 1;
206 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
207}
208
209#define sigdelset(set, sig) \
210 (__builtin_constant_p(sig) \
211 ? __const_sigdelset((set), (sig)) \
212 : __gen_sigdelset((set), (sig)))
213
214
215static inline void __gen_sigdelset(sigset_t *set, int _sig)
216{
217 asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
218}
219
220static inline void __const_sigdelset(sigset_t *set, int _sig)
221{
222 unsigned long sig = _sig - 1;
223 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
224}
225
226static inline int __const_sigismember(sigset_t *set, int _sig)
227{
228 unsigned long sig = _sig - 1;
229 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
230}
231
232static inline int __gen_sigismember(sigset_t *set, int _sig)
233{
234 int ret;
235 asm("btl %2,%1\n\tsbbl %0,%0"
236 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
237 return ret;
238}
239
240#define sigismember(set, sig) \
241 (__builtin_constant_p(sig) \
242 ? __const_sigismember((set), (sig)) \
243 : __gen_sigismember((set), (sig)))
244
245static inline int sigfindinword(unsigned long word)
246{
247 asm("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
248 return word;
249}
250
251struct pt_regs;
252
253#else
254
255#undef __HAVE_ARCH_SIG_BITOPS
256
257#endif
258
259#define ptrace_signal_deliver(regs, cookie) do { } while (0)
260
261#endif
262#endif
263
264#endif
265