blob: c7b4fb1fa14dda9ae9fe18d38346d61c70ecf1a1 [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
Greg Ungerer8dba99e2009-03-16 22:10:08 +100019struct old_sigaction {
20 __sighandler_t sa_handler;
21 old_sigset_t sa_mask;
22 unsigned long sa_flags;
23 __sigrestore_t sa_restorer;
24};
25
Al Viro574c4862012-11-25 22:24:19 -050026#define __ARCH_HAS_SA_RESTORER
Greg Ungerer8dba99e2009-03-16 22:10:08 +100027
Greg Ungerer8dba99e2009-03-16 22:10:08 +100028#include <asm/sigcontext.h>
29
Greg Ungererf3c23a22011-07-04 14:23:09 +100030#ifndef CONFIG_CPU_HAS_NO_BITFIELDS
Greg Ungerer8dba99e2009-03-16 22:10:08 +100031#define __HAVE_ARCH_SIG_BITOPS
32
33static inline void sigaddset(sigset_t *set, int _sig)
34{
35 asm ("bfset %0{%1,#1}"
Andreas Schwab34fa78b2012-11-17 22:27:04 +010036 : "+o" (*set)
Greg Ungerer8dba99e2009-03-16 22:10:08 +100037 : "id" ((_sig - 1) ^ 31)
38 : "cc");
39}
40
41static inline void sigdelset(sigset_t *set, int _sig)
42{
43 asm ("bfclr %0{%1,#1}"
Andreas Schwab34fa78b2012-11-17 22:27:04 +010044 : "+o" (*set)
Greg Ungerer8dba99e2009-03-16 22:10:08 +100045 : "id" ((_sig - 1) ^ 31)
46 : "cc");
47}
48
49static inline int __const_sigismember(sigset_t *set, int _sig)
50{
51 unsigned long sig = _sig - 1;
52 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
53}
54
55static inline int __gen_sigismember(sigset_t *set, int _sig)
56{
57 int ret;
58 asm ("bfextu %1{%2,#1},%0"
59 : "=d" (ret)
Andreas Schwab34fa78b2012-11-17 22:27:04 +010060 : "o" (*set), "id" ((_sig-1) ^ 31)
Greg Ungerer8dba99e2009-03-16 22:10:08 +100061 : "cc");
62 return ret;
63}
64
65#define sigismember(set,sig) \
66 (__builtin_constant_p(sig) ? \
67 __const_sigismember(set,sig) : \
68 __gen_sigismember(set,sig))
69
70static inline int sigfindinword(unsigned long word)
71{
72 asm ("bfffo %1{#0,#0},%0"
73 : "=d" (word)
74 : "d" (word & -word)
75 : "cc");
76 return word ^ 31;
77}
78
Greg Ungererf3c23a22011-07-04 14:23:09 +100079#endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */
80
Al Viro4f4202f2012-11-05 12:59:15 -050081#ifndef __uClinux__
Al Virob7f95912012-11-05 13:06:22 -050082extern void ptrace_signal_deliver(void);
Al Viro4f4202f2012-11-05 12:59:15 -050083#define ptrace_signal_deliver ptrace_signal_deliver
Greg Ungerer8dba99e2009-03-16 22:10:08 +100084#endif /* __uClinux__ */
Greg Ungerer8dba99e2009-03-16 22:10:08 +100085
86#endif /* _M68K_SIGNAL_H */