2008-10-23 12:26:29 +07:00
|
|
|
#ifndef _ASM_X86_SIGNAL_H
|
|
|
|
#define _ASM_X86_SIGNAL_H
|
2007-10-24 03:37:24 +07: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 16:20:03 +07:00
|
|
|
#else
|
2007-10-24 03:37:24 +07: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 06:05:27 +07:00
|
|
|
#ifndef CONFIG_COMPAT
|
|
|
|
typedef sigset_t compat_sigset_t;
|
|
|
|
#endif
|
|
|
|
|
2007-10-24 03:37:24 +07:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2012-12-15 05:37:13 +07:00
|
|
|
#include <uapi/asm/signal.h>
|
2007-10-24 03:37:24 +07:00
|
|
|
#ifndef __ASSEMBLY__
|
2008-12-15 23:54:48 +07:00
|
|
|
extern void do_notify_resume(struct pt_regs *, void *, __u32);
|
2007-10-24 03:37:24 +07:00
|
|
|
#ifdef __i386__
|
|
|
|
struct old_sigaction {
|
|
|
|
__sighandler_t sa_handler;
|
|
|
|
old_sigset_t sa_mask;
|
|
|
|
unsigned long sa_flags;
|
|
|
|
__sigrestore_t sa_restorer;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sigaction {
|
|
|
|
__sighandler_t sa_handler;
|
|
|
|
unsigned long sa_flags;
|
|
|
|
__sigrestore_t sa_restorer;
|
|
|
|
sigset_t sa_mask; /* mask last for extensibility */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct k_sigaction {
|
|
|
|
struct sigaction sa;
|
|
|
|
};
|
2008-07-21 23:07:52 +07:00
|
|
|
|
2007-10-24 03:37:24 +07:00
|
|
|
#else /* __i386__ */
|
|
|
|
#endif /* !__i386__ */
|
|
|
|
#include <asm/sigcontext.h>
|
|
|
|
|
2008-07-15 03:40:23 +07:00
|
|
|
#ifdef __i386__
|
2007-10-24 03:37:24 +07:00
|
|
|
|
|
|
|
#define __HAVE_ARCH_SIG_BITOPS
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
#define sigaddset(set,sig) \
|
2008-07-15 03:40:23 +07:00
|
|
|
(__builtin_constant_p(sig) \
|
2008-03-23 15:03:28 +07:00
|
|
|
? __const_sigaddset((set), (sig)) \
|
|
|
|
: __gen_sigaddset((set), (sig)))
|
2007-10-24 03:37:24 +07:00
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
static inline void __gen_sigaddset(sigset_t *set, int _sig)
|
2007-10-24 03:37:24 +07:00
|
|
|
{
|
2008-03-23 15:03:28 +07:00
|
|
|
asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
|
2007-10-24 03:37:24 +07:00
|
|
|
}
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
static inline void __const_sigaddset(sigset_t *set, int _sig)
|
2007-10-24 03:37:24 +07:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
|
|
|
|
}
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
#define sigdelset(set, sig) \
|
|
|
|
(__builtin_constant_p(sig) \
|
|
|
|
? __const_sigdelset((set), (sig)) \
|
|
|
|
: __gen_sigdelset((set), (sig)))
|
2007-10-24 03:37:24 +07:00
|
|
|
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
static inline void __gen_sigdelset(sigset_t *set, int _sig)
|
2007-10-24 03:37:24 +07:00
|
|
|
{
|
2008-03-23 15:03:28 +07:00
|
|
|
asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
|
2007-10-24 03:37:24 +07:00
|
|
|
}
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
static inline void __const_sigdelset(sigset_t *set, int _sig)
|
2007-10-24 03:37:24 +07:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
|
|
|
|
}
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
static inline int __const_sigismember(sigset_t *set, int _sig)
|
2007-10-24 03:37:24 +07:00
|
|
|
{
|
|
|
|
unsigned long sig = _sig - 1;
|
|
|
|
return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
|
|
|
|
}
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
static inline int __gen_sigismember(sigset_t *set, int _sig)
|
2007-10-24 03:37:24 +07:00
|
|
|
{
|
|
|
|
int ret;
|
2008-03-23 15:03:28 +07:00
|
|
|
asm("btl %2,%1\n\tsbbl %0,%0"
|
|
|
|
: "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
|
2007-10-24 03:37:24 +07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
#define sigismember(set, sig) \
|
|
|
|
(__builtin_constant_p(sig) \
|
|
|
|
? __const_sigismember((set), (sig)) \
|
|
|
|
: __gen_sigismember((set), (sig)))
|
2007-10-24 03:37:24 +07:00
|
|
|
|
2008-03-23 15:03:28 +07:00
|
|
|
static inline int sigfindinword(unsigned long word)
|
2007-10-24 03:37:24 +07:00
|
|
|
{
|
2008-03-23 15:03:28 +07:00
|
|
|
asm("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
|
2007-10-24 03:37:24 +07:00
|
|
|
return word;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct pt_regs;
|
|
|
|
|
|
|
|
#else /* __i386__ */
|
|
|
|
|
|
|
|
#undef __HAVE_ARCH_SIG_BITOPS
|
|
|
|
|
2008-01-30 19:30:50 +07:00
|
|
|
#endif /* !__i386__ */
|
|
|
|
|
2007-10-24 03:37:24 +07:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2008-10-23 12:26:29 +07:00
|
|
|
#endif /* _ASM_X86_SIGNAL_H */
|