2008-10-23 13:26:29 +08:00
|
|
|
#ifndef _ASM_X86_SIGNAL_H
|
|
|
|
#define _ASM_X86_SIGNAL_H
|
2007-10-24 04:37:24 +08:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
|
|
|
|
/* Most things should be clean enough to redefine this at will, if care
|
|
|
|
is taken to make libc match. */
|
|
|
|
|
|
|
|
#define _NSIG 64
|
|
|
|
|
|
|
|
#ifdef __i386__
|
|
|
|
# define _NSIG_BPW 32
|
2007-10-11 17:20:03 +08:00
|
|
|
#else
|
2007-10-24 04:37:24 +08:00
|
|
|
# define _NSIG_BPW 64
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
|
|
|
|
|
|
|
|
typedef unsigned long old_sigset_t; /* at least 32 bits */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned long sig[_NSIG_WORDS];
|
|
|
|
} sigset_t;
|
|
|
|
|
2012-07-25 07:05:27 +08:00
|
|
|
#ifndef CONFIG_COMPAT
|
|
|
|
typedef sigset_t compat_sigset_t;
|
|
|
|
#endif
|
|
|
|
|
2007-10-24 04:37:24 +08:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2012-12-15 06:37:13 +08:00
|
|
|
#include <uapi/asm/signal.h>
|
2007-10-24 04:37:24 +08:00
|
|
|
#ifndef __ASSEMBLY__
|
2015-07-04 03:44:23 +08:00
|
|
|
extern void do_signal(struct pt_regs *regs);
|
2012-11-26 11:24:19 +08:00
|
|
|
|
|
|
|
#define __ARCH_HAS_SA_RESTORER
|
|
|
|
|
2015-09-05 15:32:43 +08:00
|
|
|
#include <uapi/asm/sigcontext.h>
|
2007-10-24 04:37:24 +08:00
|
|
|
|
2008-07-15 04:40:23 +08:00
|
|
|
#ifdef __i386__
|
2007-10-24 04:37:24 +08:00
|
|
|
|
|
|
|
#define __HAVE_ARCH_SIG_BITOPS
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
#define sigaddset(set,sig) \
|
2008-07-15 04:40:23 +08:00
|
|
|
(__builtin_constant_p(sig) \
|
2008-03-23 16:03:28 +08:00
|
|
|
? __const_sigaddset((set), (sig)) \
|
|
|
|
: __gen_sigaddset((set), (sig)))
|
2007-10-24 04:37:24 +08:00
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
static inline void __gen_sigaddset(sigset_t *set, int _sig)
|
2007-10-24 04:37:24 +08:00
|
|
|
{
|
2008-03-23 16:03:28 +08:00
|
|
|
asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
|
2007-10-24 04:37:24 +08:00
|
|
|
}
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
static inline void __const_sigaddset(sigset_t *set, int _sig)
|
2007-10-24 04:37:24 +08:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
|
|
|
|
}
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
#define sigdelset(set, sig) \
|
|
|
|
(__builtin_constant_p(sig) \
|
|
|
|
? __const_sigdelset((set), (sig)) \
|
|
|
|
: __gen_sigdelset((set), (sig)))
|
2007-10-24 04:37:24 +08:00
|
|
|
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
static inline void __gen_sigdelset(sigset_t *set, int _sig)
|
2007-10-24 04:37:24 +08:00
|
|
|
{
|
2008-03-23 16:03:28 +08:00
|
|
|
asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
|
2007-10-24 04:37:24 +08:00
|
|
|
}
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
static inline void __const_sigdelset(sigset_t *set, int _sig)
|
2007-10-24 04:37:24 +08:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
|
|
|
|
}
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
static inline int __const_sigismember(sigset_t *set, int _sig)
|
2007-10-24 04:37:24 +08:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
|
|
|
|
}
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
static inline int __gen_sigismember(sigset_t *set, int _sig)
|
2007-10-24 04:37:24 +08:00
|
|
|
{
|
|
|
|
int ret;
|
2008-03-23 16:03:28 +08:00
|
|
|
asm("btl %2,%1\n\tsbbl %0,%0"
|
|
|
|
: "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
|
2007-10-24 04:37:24 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-03-23 16:03:28 +08:00
|
|
|
#define sigismember(set, sig) \
|
|
|
|
(__builtin_constant_p(sig) \
|
|
|
|
? __const_sigismember((set), (sig)) \
|
|
|
|
: __gen_sigismember((set), (sig)))
|
2007-10-24 04:37:24 +08:00
|
|
|
|
|
|
|
struct pt_regs;
|
|
|
|
|
|
|
|
#else /* __i386__ */
|
|
|
|
|
|
|
|
#undef __HAVE_ARCH_SIG_BITOPS
|
|
|
|
|
2008-01-30 20:30:50 +08:00
|
|
|
#endif /* !__i386__ */
|
|
|
|
|
2007-10-24 04:37:24 +08:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2008-10-23 13:26:29 +08:00
|
|
|
#endif /* _ASM_X86_SIGNAL_H */
|