1 #ifndef _ASM_X86_SIGNAL_H
2 #define _ASM_X86_SIGNAL_H
5 #include <linux/linkage.h>
7 /* Most things should be clean enough to redefine this at will, if care
8 is taken to make libc match. */
18 #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
20 typedef unsigned long old_sigset_t; /* at least 32 bits */
23 unsigned long sig[_NSIG_WORDS];
27 * Because some traps use the IST stack, we must keep preemption
28 * disabled while calling do_trap(), but do_trap() may call
29 * force_sig_info() which will grab the signal spin_locks for the
30 * task, which in PREEMPT_RT_FULL are mutexes. By defining
31 * ARCH_RT_DELAYS_SIGNAL_SEND the force_sig_info() will set
32 * TIF_NOTIFY_RESUME and set up the signal to be sent on exit of the
35 #if defined(CONFIG_PREEMPT_RT_FULL)
36 #define ARCH_RT_DELAYS_SIGNAL_SEND
40 typedef sigset_t compat_sigset_t;
43 #endif /* __ASSEMBLY__ */
44 #include <uapi/asm/signal.h>
46 extern void do_signal(struct pt_regs *regs);
48 #define __ARCH_HAS_SA_RESTORER
50 #include <uapi/asm/sigcontext.h>
54 #define __HAVE_ARCH_SIG_BITOPS
56 #define sigaddset(set,sig) \
57 (__builtin_constant_p(sig) \
58 ? __const_sigaddset((set), (sig)) \
59 : __gen_sigaddset((set), (sig)))
61 static inline void __gen_sigaddset(sigset_t *set, int _sig)
63 asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
66 static inline void __const_sigaddset(sigset_t *set, int _sig)
68 unsigned long sig = _sig - 1;
69 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
72 #define sigdelset(set, sig) \
73 (__builtin_constant_p(sig) \
74 ? __const_sigdelset((set), (sig)) \
75 : __gen_sigdelset((set), (sig)))
78 static inline void __gen_sigdelset(sigset_t *set, int _sig)
80 asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
83 static inline void __const_sigdelset(sigset_t *set, int _sig)
85 unsigned long sig = _sig - 1;
86 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
89 static inline int __const_sigismember(sigset_t *set, int _sig)
91 unsigned long sig = _sig - 1;
92 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
95 static inline int __gen_sigismember(sigset_t *set, int _sig)
98 asm("btl %2,%1\n\tsbbl %0,%0"
99 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
103 #define sigismember(set, sig) \
104 (__builtin_constant_p(sig) \
105 ? __const_sigismember((set), (sig)) \
106 : __gen_sigismember((set), (sig)))
112 #undef __HAVE_ARCH_SIG_BITOPS
114 #endif /* !__i386__ */
116 #endif /* __ASSEMBLY__ */
117 #endif /* _ASM_X86_SIGNAL_H */