1 #ifndef _ASM_X86_SIGNAL_H
2 #define _ASM_X86_SIGNAL_H
5 #include <linux/types.h>
6 #include <linux/time.h>
7 #include <linux/compiler.h>
9 /* Avoid too many header ordering problems. */
13 #include <linux/linkage.h>
15 /* Most things should be clean enough to redefine this at will, if care
16 is taken to make libc match. */
26 #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
28 typedef unsigned long old_sigset_t
; /* at least 32 bits */
31 unsigned long sig
[_NSIG_WORDS
];
35 /* Here we must cater to libcs that poke about in kernel headers. */
38 typedef unsigned long sigset_t
;
40 #endif /* __KERNEL__ */
41 #endif /* __ASSEMBLY__ */
81 /* These should not be considered constants from userland. */
83 #define SIGRTMAX _NSIG
88 * SA_ONSTACK indicates that a registered stack_t will be used.
89 * SA_RESTART flag to get restarting signals (which were the default long ago)
90 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
91 * SA_RESETHAND clears the handler when the signal is delivered.
92 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
93 * SA_NODEFER prevents the current signal from being masked in the handler.
95 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
96 * Unix names RESETHAND and NODEFER respectively.
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
106 #define SA_NOMASK SA_NODEFER
107 #define SA_ONESHOT SA_RESETHAND
109 #define SA_RESTORER 0x04000000
112 * sigaltstack controls
117 #define MINSIGSTKSZ 2048
118 #define SIGSTKSZ 8192
120 #include <asm-generic/signal.h>
126 struct old_sigaction
{
127 __sighandler_t sa_handler
;
128 old_sigset_t sa_mask
;
129 unsigned long sa_flags
;
130 __sigrestore_t sa_restorer
;
134 __sighandler_t sa_handler
;
135 unsigned long sa_flags
;
136 __sigrestore_t sa_restorer
;
137 sigset_t sa_mask
; /* mask last for extensibility */
143 # else /* __KERNEL__ */
144 /* Here we must cater to libcs that poke about in kernel headers. */
148 __sighandler_t _sa_handler
;
149 void (*_sa_sigaction
)(int, struct siginfo
*, void *);
152 unsigned long sa_flags
;
153 void (*sa_restorer
)(void);
156 #define sa_handler _u._sa_handler
157 #define sa_sigaction _u._sa_sigaction
159 # endif /* ! __KERNEL__ */
163 __sighandler_t sa_handler
;
164 unsigned long sa_flags
;
165 __sigrestore_t sa_restorer
;
166 sigset_t sa_mask
; /* mask last for extensibility */
173 #endif /* !__i386__ */
175 typedef struct sigaltstack
{
182 #include <asm/sigcontext.h>
186 #define __HAVE_ARCH_SIG_BITOPS
188 #define sigaddset(set,sig) \
189 (__builtin_constantp(sig) \
190 ? __const_sigaddset((set), (sig)) \
191 : __gen_sigaddset((set), (sig)))
193 static inline void __gen_sigaddset(sigset_t
*set
, int _sig
)
195 asm("btsl %1,%0" : "+m"(*set
) : "Ir"(_sig
- 1) : "cc");
198 static inline void __const_sigaddset(sigset_t
*set
, int _sig
)
200 unsigned long sig
= _sig
- 1;
201 set
->sig
[sig
/ _NSIG_BPW
] |= 1 << (sig
% _NSIG_BPW
);
204 #define sigdelset(set, sig) \
205 (__builtin_constant_p(sig) \
206 ? __const_sigdelset((set), (sig)) \
207 : __gen_sigdelset((set), (sig)))
210 static inline void __gen_sigdelset(sigset_t
*set
, int _sig
)
212 asm("btrl %1,%0" : "+m"(*set
) : "Ir"(_sig
- 1) : "cc");
215 static inline void __const_sigdelset(sigset_t
*set
, int _sig
)
217 unsigned long sig
= _sig
- 1;
218 set
->sig
[sig
/ _NSIG_BPW
] &= ~(1 << (sig
% _NSIG_BPW
));
221 static inline int __const_sigismember(sigset_t
*set
, int _sig
)
223 unsigned long sig
= _sig
- 1;
224 return 1 & (set
->sig
[sig
/ _NSIG_BPW
] >> (sig
% _NSIG_BPW
));
227 static inline int __gen_sigismember(sigset_t
*set
, int _sig
)
230 asm("btl %2,%1\n\tsbbl %0,%0"
231 : "=r"(ret
) : "m"(*set
), "Ir"(_sig
-1) : "cc");
235 #define sigismember(set, sig) \
236 (__builtin_constant_p(sig) \
237 ? __const_sigismember((set), (sig)) \
238 : __gen_sigismember((set), (sig)))
240 static inline int sigfindinword(unsigned long word
)
242 asm("bsfl %1,%0" : "=r"(word
) : "rm"(word
) : "cc");
250 #undef __HAVE_ARCH_SIG_BITOPS
252 #endif /* !__i386__ */
254 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
256 #endif /* __KERNEL__ */
257 #endif /* __ASSEMBLY__ */