2008-10-23 05:26:29 +00:00
|
|
|
#ifndef _ASM_X86_SIGNAL_H
|
|
|
|
#define _ASM_X86_SIGNAL_H
|
2007-10-23 20:37:24 +00: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 09:20:03 +00:00
|
|
|
#else
|
2007-10-23 20:37:24 +00: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;
|
|
|
|
|
2016-09-05 13:33:08 +00:00
|
|
|
/* non-uapi in-kernel SA_FLAGS for those indicates ABI for a signal frame */
|
|
|
|
#define SA_IA32_ABI 0x02000000u
|
|
|
|
#define SA_X32_ABI 0x01000000u
|
|
|
|
|
2012-07-24 23:05:27 +00:00
|
|
|
#ifndef CONFIG_COMPAT
|
|
|
|
typedef sigset_t compat_sigset_t;
|
|
|
|
#endif
|
|
|
|
|
2007-10-23 20:37:24 +00:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2012-12-14 22:37:13 +00:00
|
|
|
#include <uapi/asm/signal.h>
|
2007-10-23 20:37:24 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
2015-07-03 19:44:23 +00:00
|
|
|
extern void do_signal(struct pt_regs *regs);
|
2012-11-26 03:24:19 +00:00
|
|
|
|
|
|
|
#define __ARCH_HAS_SA_RESTORER
|
|
|
|
|
2015-09-05 07:32:43 +00:00
|
|
|
#include <uapi/asm/sigcontext.h>
|
2007-10-23 20:37:24 +00:00
|
|
|
|
2008-07-14 20:40:23 +00:00
|
|
|
#ifdef __i386__
|
2007-10-23 20:37:24 +00:00
|
|
|
|
|
|
|
#define __HAVE_ARCH_SIG_BITOPS
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
#define sigaddset(set,sig) \
|
2008-07-14 20:40:23 +00:00
|
|
|
(__builtin_constant_p(sig) \
|
2008-03-23 08:03:28 +00:00
|
|
|
? __const_sigaddset((set), (sig)) \
|
|
|
|
: __gen_sigaddset((set), (sig)))
|
2007-10-23 20:37:24 +00:00
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
static inline void __gen_sigaddset(sigset_t *set, int _sig)
|
2007-10-23 20:37:24 +00:00
|
|
|
{
|
2008-03-23 08:03:28 +00:00
|
|
|
asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
|
2007-10-23 20:37:24 +00:00
|
|
|
}
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
static inline void __const_sigaddset(sigset_t *set, int _sig)
|
2007-10-23 20:37:24 +00:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
|
|
|
|
}
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
#define sigdelset(set, sig) \
|
|
|
|
(__builtin_constant_p(sig) \
|
|
|
|
? __const_sigdelset((set), (sig)) \
|
|
|
|
: __gen_sigdelset((set), (sig)))
|
2007-10-23 20:37:24 +00:00
|
|
|
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
static inline void __gen_sigdelset(sigset_t *set, int _sig)
|
2007-10-23 20:37:24 +00:00
|
|
|
{
|
2008-03-23 08:03:28 +00:00
|
|
|
asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
|
2007-10-23 20:37:24 +00:00
|
|
|
}
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
static inline void __const_sigdelset(sigset_t *set, int _sig)
|
2007-10-23 20:37:24 +00:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
|
|
|
|
}
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
static inline int __const_sigismember(sigset_t *set, int _sig)
|
2007-10-23 20:37:24 +00:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
|
|
|
|
}
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
static inline int __gen_sigismember(sigset_t *set, int _sig)
|
2007-10-23 20:37:24 +00:00
|
|
|
{
|
2016-06-08 19:38:37 +00:00
|
|
|
unsigned char ret;
|
|
|
|
asm("btl %2,%1\n\tsetc %0"
|
|
|
|
: "=qm"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
|
2007-10-23 20:37:24 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-03-23 08:03:28 +00:00
|
|
|
#define sigismember(set, sig) \
|
|
|
|
(__builtin_constant_p(sig) \
|
|
|
|
? __const_sigismember((set), (sig)) \
|
|
|
|
: __gen_sigismember((set), (sig)))
|
2007-10-23 20:37:24 +00:00
|
|
|
|
|
|
|
struct pt_regs;
|
|
|
|
|
|
|
|
#else /* __i386__ */
|
|
|
|
|
|
|
|
#undef __HAVE_ARCH_SIG_BITOPS
|
|
|
|
|
2008-01-30 12:30:50 +00:00
|
|
|
#endif /* !__i386__ */
|
|
|
|
|
2007-10-23 20:37:24 +00:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2008-10-23 05:26:29 +00:00
|
|
|
#endif /* _ASM_X86_SIGNAL_H */
|