Linux Audio

Check our new training course

Loading...
v6.2
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef _ASM_X86_SIGNAL_H
  3#define _ASM_X86_SIGNAL_H
  4
  5#ifndef __ASSEMBLY__
  6#include <linux/linkage.h>
  7
  8/* Most things should be clean enough to redefine this at will, if care
  9   is taken to make libc match.  */
 10
 11#define _NSIG		64
 12
 13#ifdef __i386__
 14# define _NSIG_BPW	32
 15#else
 16# define _NSIG_BPW	64
 17#endif
 18
 19#define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
 20
 21typedef unsigned long old_sigset_t;		/* at least 32 bits */
 22
 23typedef struct {
 24	unsigned long sig[_NSIG_WORDS];
 25} sigset_t;
 26
 27/* non-uapi in-kernel SA_FLAGS for those indicates ABI for a signal frame */
 28#define SA_IA32_ABI	0x02000000u
 29#define SA_X32_ABI	0x01000000u
 30
 31#endif /* __ASSEMBLY__ */
 32#include <uapi/asm/signal.h>
 33#ifndef __ASSEMBLY__
 
 34
 35#define __ARCH_HAS_SA_RESTORER
 36
 37#include <asm/asm.h>
 38#include <uapi/asm/sigcontext.h>
 39
 40#ifdef __i386__
 41
 42#define __HAVE_ARCH_SIG_BITOPS
 43
 44#define sigaddset(set,sig)		    \
 45	(__builtin_constant_p(sig)	    \
 46	 ? __const_sigaddset((set), (sig))  \
 47	 : __gen_sigaddset((set), (sig)))
 48
 49static inline void __gen_sigaddset(sigset_t *set, int _sig)
 50{
 51	asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
 52}
 53
 54static inline void __const_sigaddset(sigset_t *set, int _sig)
 55{
 56	unsigned long sig = _sig - 1;
 57	set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
 58}
 59
 60#define sigdelset(set, sig)		    \
 61	(__builtin_constant_p(sig)	    \
 62	 ? __const_sigdelset((set), (sig))  \
 63	 : __gen_sigdelset((set), (sig)))
 64
 65
 66static inline void __gen_sigdelset(sigset_t *set, int _sig)
 67{
 68	asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
 69}
 70
 71static inline void __const_sigdelset(sigset_t *set, int _sig)
 72{
 73	unsigned long sig = _sig - 1;
 74	set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
 75}
 76
 77static inline int __const_sigismember(sigset_t *set, int _sig)
 78{
 79	unsigned long sig = _sig - 1;
 80	return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
 81}
 82
 83static inline int __gen_sigismember(sigset_t *set, int _sig)
 84{
 85	bool ret;
 86	asm("btl %2,%1" CC_SET(c)
 87	    : CC_OUT(c) (ret) : "m"(*set), "Ir"(_sig-1));
 88	return ret;
 89}
 90
 91#define sigismember(set, sig)			\
 92	(__builtin_constant_p(sig)		\
 93	 ? __const_sigismember((set), (sig))	\
 94	 : __gen_sigismember((set), (sig)))
 95
 96struct pt_regs;
 97
 98#else /* __i386__ */
 99
100#undef __HAVE_ARCH_SIG_BITOPS
101
102#endif /* !__i386__ */
103
104#endif /* __ASSEMBLY__ */
105#endif /* _ASM_X86_SIGNAL_H */
v4.6
 
  1#ifndef _ASM_X86_SIGNAL_H
  2#define _ASM_X86_SIGNAL_H
  3
  4#ifndef __ASSEMBLY__
  5#include <linux/linkage.h>
  6
  7/* Most things should be clean enough to redefine this at will, if care
  8   is taken to make libc match.  */
  9
 10#define _NSIG		64
 11
 12#ifdef __i386__
 13# define _NSIG_BPW	32
 14#else
 15# define _NSIG_BPW	64
 16#endif
 17
 18#define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
 19
 20typedef unsigned long old_sigset_t;		/* at least 32 bits */
 21
 22typedef struct {
 23	unsigned long sig[_NSIG_WORDS];
 24} sigset_t;
 25
 26#ifndef CONFIG_COMPAT
 27typedef sigset_t compat_sigset_t;
 28#endif
 29
 30#endif /* __ASSEMBLY__ */
 31#include <uapi/asm/signal.h>
 32#ifndef __ASSEMBLY__
 33extern void do_signal(struct pt_regs *regs);
 34
 35#define __ARCH_HAS_SA_RESTORER
 36
 
 37#include <uapi/asm/sigcontext.h>
 38
 39#ifdef __i386__
 40
 41#define __HAVE_ARCH_SIG_BITOPS
 42
 43#define sigaddset(set,sig)		    \
 44	(__builtin_constant_p(sig)	    \
 45	 ? __const_sigaddset((set), (sig))  \
 46	 : __gen_sigaddset((set), (sig)))
 47
 48static inline void __gen_sigaddset(sigset_t *set, int _sig)
 49{
 50	asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
 51}
 52
 53static inline void __const_sigaddset(sigset_t *set, int _sig)
 54{
 55	unsigned long sig = _sig - 1;
 56	set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
 57}
 58
 59#define sigdelset(set, sig)		    \
 60	(__builtin_constant_p(sig)	    \
 61	 ? __const_sigdelset((set), (sig))  \
 62	 : __gen_sigdelset((set), (sig)))
 63
 64
 65static inline void __gen_sigdelset(sigset_t *set, int _sig)
 66{
 67	asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
 68}
 69
 70static inline void __const_sigdelset(sigset_t *set, int _sig)
 71{
 72	unsigned long sig = _sig - 1;
 73	set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
 74}
 75
 76static inline int __const_sigismember(sigset_t *set, int _sig)
 77{
 78	unsigned long sig = _sig - 1;
 79	return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
 80}
 81
 82static inline int __gen_sigismember(sigset_t *set, int _sig)
 83{
 84	int ret;
 85	asm("btl %2,%1\n\tsbbl %0,%0"
 86	    : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
 87	return ret;
 88}
 89
 90#define sigismember(set, sig)			\
 91	(__builtin_constant_p(sig)		\
 92	 ? __const_sigismember((set), (sig))	\
 93	 : __gen_sigismember((set), (sig)))
 94
 95struct pt_regs;
 96
 97#else /* __i386__ */
 98
 99#undef __HAVE_ARCH_SIG_BITOPS
100
101#endif /* !__i386__ */
102
103#endif /* __ASSEMBLY__ */
104#endif /* _ASM_X86_SIGNAL_H */