x86/mm/pat: Don't report PAT on CPUs that don't support it
[linux/fpc-iii.git] / arch / x86 / include / asm / signal.h
blob8af22be0fe61fa001ef1f174333036ead355e8cb
1 #ifndef _ASM_X86_SIGNAL_H
2 #define _ASM_X86_SIGNAL_H
4 #ifndef __ASSEMBLY__
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. */
10 #define _NSIG 64
12 #ifdef __i386__
13 # define _NSIG_BPW 32
14 #else
15 # define _NSIG_BPW 64
16 #endif
18 #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
20 typedef unsigned long old_sigset_t; /* at least 32 bits */
22 typedef struct {
23 unsigned long sig[_NSIG_WORDS];
24 } sigset_t;
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
30 #ifndef CONFIG_COMPAT
31 typedef sigset_t compat_sigset_t;
32 #endif
34 #endif /* __ASSEMBLY__ */
35 #include <uapi/asm/signal.h>
36 #ifndef __ASSEMBLY__
37 extern void do_signal(struct pt_regs *regs);
39 #define __ARCH_HAS_SA_RESTORER
41 #include <uapi/asm/sigcontext.h>
43 #ifdef __i386__
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)
88 unsigned char ret;
89 asm("btl %2,%1\n\tsetc %0"
90 : "=qm"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
91 return ret;
94 #define sigismember(set, sig) \
95 (__builtin_constant_p(sig) \
96 ? __const_sigismember((set), (sig)) \
97 : __gen_sigismember((set), (sig)))
99 struct pt_regs;
101 #else /* __i386__ */
103 #undef __HAVE_ARCH_SIG_BITOPS
105 #endif /* !__i386__ */
107 #endif /* __ASSEMBLY__ */
108 #endif /* _ASM_X86_SIGNAL_H */