Commit | Line | Data |
---|---|---|
1965aae3 PA |
1 | #ifndef _ASM_X86_SIGNAL_H |
2 | #define _ASM_X86_SIGNAL_H | |
33185c50 TG |
3 | |
4 | #ifndef __ASSEMBLY__ | |
33185c50 TG |
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 | |
96a388de | 14 | #else |
33185c50 TG |
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 | ||
050902c0 SS |
26 | #ifndef CONFIG_COMPAT |
27 | typedef sigset_t compat_sigset_t; | |
28 | #endif | |
29 | ||
33185c50 | 30 | #endif /* __ASSEMBLY__ */ |
af170c50 | 31 | #include <uapi/asm/signal.h> |
33185c50 | 32 | #ifndef __ASSEMBLY__ |
1f484aa6 | 33 | extern void do_signal(struct pt_regs *regs); |
574c4866 AV |
34 | |
35 | #define __ARCH_HAS_SA_RESTORER | |
36 | ||
decb4c41 | 37 | #include <uapi/asm/sigcontext.h> |
33185c50 | 38 | |
723edb50 | 39 | #ifdef __i386__ |
33185c50 TG |
40 | |
41 | #define __HAVE_ARCH_SIG_BITOPS | |
42 | ||
9551b12a | 43 | #define sigaddset(set,sig) \ |
723edb50 | 44 | (__builtin_constant_p(sig) \ |
9551b12a JP |
45 | ? __const_sigaddset((set), (sig)) \ |
46 | : __gen_sigaddset((set), (sig))) | |
33185c50 | 47 | |
9551b12a | 48 | static inline void __gen_sigaddset(sigset_t *set, int _sig) |
33185c50 | 49 | { |
9551b12a | 50 | asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); |
33185c50 TG |
51 | } |
52 | ||
9551b12a | 53 | static inline void __const_sigaddset(sigset_t *set, int _sig) |
33185c50 TG |
54 | { |
55 | unsigned long sig = _sig - 1; | |
56 | set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW); | |
57 | } | |
58 | ||
9551b12a JP |
59 | #define sigdelset(set, sig) \ |
60 | (__builtin_constant_p(sig) \ | |
61 | ? __const_sigdelset((set), (sig)) \ | |
62 | : __gen_sigdelset((set), (sig))) | |
33185c50 TG |
63 | |
64 | ||
9551b12a | 65 | static inline void __gen_sigdelset(sigset_t *set, int _sig) |
33185c50 | 66 | { |
9551b12a | 67 | asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc"); |
33185c50 TG |
68 | } |
69 | ||
9551b12a | 70 | static inline void __const_sigdelset(sigset_t *set, int _sig) |
33185c50 TG |
71 | { |
72 | unsigned long sig = _sig - 1; | |
73 | set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW)); | |
74 | } | |
75 | ||
9551b12a | 76 | static inline int __const_sigismember(sigset_t *set, int _sig) |
33185c50 TG |
77 | { |
78 | unsigned long sig = _sig - 1; | |
79 | return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); | |
80 | } | |
81 | ||
9551b12a | 82 | static inline int __gen_sigismember(sigset_t *set, int _sig) |
33185c50 | 83 | { |
2823d4da PA |
84 | unsigned char ret; |
85 | asm("btl %2,%1\n\tsetc %0" | |
86 | : "=qm"(ret) : "m"(*set), "Ir"(_sig-1) : "cc"); | |
33185c50 TG |
87 | return ret; |
88 | } | |
89 | ||
9551b12a JP |
90 | #define sigismember(set, sig) \ |
91 | (__builtin_constant_p(sig) \ | |
92 | ? __const_sigismember((set), (sig)) \ | |
93 | : __gen_sigismember((set), (sig))) | |
33185c50 | 94 | |
33185c50 TG |
95 | struct pt_regs; |
96 | ||
33185c50 TG |
97 | #else /* __i386__ */ |
98 | ||
99 | #undef __HAVE_ARCH_SIG_BITOPS | |
100 | ||
e1f28773 RM |
101 | #endif /* !__i386__ */ |
102 | ||
33185c50 | 103 | #endif /* __ASSEMBLY__ */ |
1965aae3 | 104 | #endif /* _ASM_X86_SIGNAL_H */ |