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