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];
26 /* non-uapi in-kernel SA_FLAGS for those indicates ABI for a signal frame */
27 #define SA_IA32_ABI 0x02000000u
28 #define SA_X32_ABI 0x01000000u
31 typedef sigset_t compat_sigset_t;
34 #endif /* __ASSEMBLY__ */
35 #include <uapi/asm/signal.h>
37 extern void do_signal(struct pt_regs *regs);
39 #define __ARCH_HAS_SA_RESTORER
41 #include <uapi/asm/sigcontext.h>
45 #define __HAVE_ARCH_SIG_BITOPS
47 #define sigaddset(set,sig) \
48 (__builtin_constant_p(sig) \
49 ? __const_sigaddset((set), (sig)) \
50 : __gen_sigaddset((set), (sig)))
52 static inline void __gen_sigaddset(sigset_t *set, int _sig)
54 asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
57 static inline void __const_sigaddset(sigset_t *set, int _sig)
59 unsigned long sig = _sig - 1;
60 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
63 #define sigdelset(set, sig) \
64 (__builtin_constant_p(sig) \
65 ? __const_sigdelset((set), (sig)) \
66 : __gen_sigdelset((set), (sig)))
69 static inline void __gen_sigdelset(sigset_t *set, int _sig)
71 asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
74 static inline void __const_sigdelset(sigset_t *set, int _sig)
76 unsigned long sig = _sig - 1;
77 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
80 static inline int __const_sigismember(sigset_t *set, int _sig)
82 unsigned long sig = _sig - 1;
83 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
86 static inline int __gen_sigismember(sigset_t *set, int _sig)
89 asm("btl %2,%1\n\tsetc %0"
90 : "=qm"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
94 #define sigismember(set, sig) \
95 (__builtin_constant_p(sig) \
96 ? __const_sigismember((set), (sig)) \
97 : __gen_sigismember((set), (sig)))
103 #undef __HAVE_ARCH_SIG_BITOPS
105 #endif /* !__i386__ */
107 #endif /* __ASSEMBLY__ */
108 #endif /* _ASM_X86_SIGNAL_H */