1 #ifndef _ASM_X86_SIGNAL_H 2 #define _ASM_X86_SIGNAL_H 3 4 #ifndef __ASSEMBLY__ 5 #include <linux/linkage.h> 6 7 /* Most things should be clean enough to redefine this at will, if care 8 is taken to make libc match. */ 9 10 #define _NSIG 64 11 12 #ifdef __i386__ 13 # define _NSIG_BPW 32 14 #else 15 # define _NSIG_BPW 64 16 #endif 17 18 #define _NSIG_WORDS (_NSIG / _NSIG_BPW) 19 20 typedef unsigned long old_sigset_t; /* at least 32 bits */ 21 22 typedef struct { 23 unsigned long sig[_NSIG_WORDS]; 24 } sigset_t; 25 26 #ifndef CONFIG_COMPAT 27 typedef sigset_t compat_sigset_t; 28 #endif 29 30 #endif /* __ASSEMBLY__ */ 31 #include <uapi/asm/signal.h> 32 #ifndef __ASSEMBLY__ 33 extern void do_notify_resume(struct pt_regs *, void *, __u32); 34 35 #define __ARCH_HAS_SA_RESTORER 36 37 #ifdef __i386__ 38 struct old_sigaction { 39 __sighandler_t sa_handler; 40 old_sigset_t sa_mask; 41 unsigned long sa_flags; 42 __sigrestore_t sa_restorer; 43 }; 44 45 #endif /* !__i386__ */ 46 #include <asm/sigcontext.h> 47 48 #ifdef __i386__ 49 50 #define __HAVE_ARCH_SIG_BITOPS 51 52 #define sigaddset(set,sig) \ 53 (__builtin_constant_p(sig) \ 54 ? __const_sigaddset((set), (sig)) \ 55 : __gen_sigaddset((set), (sig))) 56 57 static inline void __gen_sigaddset(sigset_t *set, int _sig) 58 { 59 asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); 60 } 61 62 static inline void __const_sigaddset(sigset_t *set, int _sig) 63 { 64 unsigned long sig = _sig - 1; 65 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW); 66 } 67 68 #define sigdelset(set, sig) \ 69 (__builtin_constant_p(sig) \ 70 ? __const_sigdelset((set), (sig)) \ 71 : __gen_sigdelset((set), (sig))) 72 73 74 static inline void __gen_sigdelset(sigset_t *set, int _sig) 75 { 76 asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); 77 } 78 79 static inline void __const_sigdelset(sigset_t *set, int _sig) 80 { 81 unsigned long sig = _sig - 1; 82 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW)); 83 } 84 85 static inline int __const_sigismember(sigset_t *set, int _sig) 86 { 87 unsigned long sig = _sig - 1; 88 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); 89 } 90 91 static inline int __gen_sigismember(sigset_t *set, int _sig) 92 { 93 int ret; 94 asm("btl %2,%1\n\tsbbl %0,%0" 95 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc"); 96 return ret; 97 } 98 99 #define sigismember(set, sig) \ 100 (__builtin_constant_p(sig) \ 101 ? __const_sigismember((set), (sig)) \ 102 : __gen_sigismember((set), (sig))) 103 104 static inline int sigfindinword(unsigned long word) 105 { 106 asm("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc"); 107 return word; 108 } 109 110 struct pt_regs; 111 112 #else /* __i386__ */ 113 114 #undef __HAVE_ARCH_SIG_BITOPS 115 116 #endif /* !__i386__ */ 117 118 #endif /* __ASSEMBLY__ */ 119 #endif /* _ASM_X86_SIGNAL_H */ 120