blob: 8c8ce5e1ee0e67124e17bd3b0f58233094f22780 [file] [log] [blame]
Greg Ungerer8dba99e2009-03-16 22:10:08 +10001#ifndef _M68K_SIGNAL_H
2#define _M68K_SIGNAL_H
3
David Howells10b3a972012-10-09 09:47:06 +01004#include <uapi/asm/signal.h>
Greg Ungerer8dba99e2009-03-16 22:10:08 +10005
Greg Ungerer8dba99e2009-03-16 22:10:08 +10006/* Most things should be clean enough to redefine this at will, if care
7 is taken to make libc match. */
8
9#define _NSIG 64
10#define _NSIG_BPW 32
11#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
12
13typedef unsigned long old_sigset_t; /* at least 32 bits */
14
15typedef struct {
16 unsigned long sig[_NSIG_WORDS];
17} sigset_t;
18
Al Viro574c4862012-11-25 22:24:19 -050019#define __ARCH_HAS_SA_RESTORER
Greg Ungerer8dba99e2009-03-16 22:10:08 +100020
Greg Ungerer8dba99e2009-03-16 22:10:08 +100021#include <asm/sigcontext.h>
22
Greg Ungererf3c23a22011-07-04 14:23:09 +100023#ifndef CONFIG_CPU_HAS_NO_BITFIELDS
Greg Ungerer8dba99e2009-03-16 22:10:08 +100024#define __HAVE_ARCH_SIG_BITOPS
25
26static inline void sigaddset(sigset_t *set, int _sig)
27{
28 asm ("bfset %0{%1,#1}"
Andreas Schwab34fa78b2012-11-17 22:27:04 +010029 : "+o" (*set)
Greg Ungerer8dba99e2009-03-16 22:10:08 +100030 : "id" ((_sig - 1) ^ 31)
31 : "cc");
32}
33
34static inline void sigdelset(sigset_t *set, int _sig)
35{
36 asm ("bfclr %0{%1,#1}"
Andreas Schwab34fa78b2012-11-17 22:27:04 +010037 : "+o" (*set)
Greg Ungerer8dba99e2009-03-16 22:10:08 +100038 : "id" ((_sig - 1) ^ 31)
39 : "cc");
40}
41
42static inline int __const_sigismember(sigset_t *set, int _sig)
43{
44 unsigned long sig = _sig - 1;
45 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
46}
47
48static inline int __gen_sigismember(sigset_t *set, int _sig)
49{
50 int ret;
51 asm ("bfextu %1{%2,#1},%0"
52 : "=d" (ret)
Andreas Schwab34fa78b2012-11-17 22:27:04 +010053 : "o" (*set), "id" ((_sig-1) ^ 31)
Greg Ungerer8dba99e2009-03-16 22:10:08 +100054 : "cc");
55 return ret;
56}
57
58#define sigismember(set,sig) \
59 (__builtin_constant_p(sig) ? \
60 __const_sigismember(set,sig) : \
61 __gen_sigismember(set,sig))
62
Greg Ungererf3c23a22011-07-04 14:23:09 +100063#endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */
64
Al Viro4f4202f2012-11-05 12:59:15 -050065#ifndef __uClinux__
Al Virob7f95912012-11-05 13:06:22 -050066extern void ptrace_signal_deliver(void);
Al Viro4f4202f2012-11-05 12:59:15 -050067#define ptrace_signal_deliver ptrace_signal_deliver
Greg Ungerer8dba99e2009-03-16 22:10:08 +100068#endif /* __uClinux__ */
Greg Ungerer8dba99e2009-03-16 22:10:08 +100069
70#endif /* _M68K_SIGNAL_H */