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