Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 1 | #ifndef _M68K_SIGNAL_H |
| 2 | #define _M68K_SIGNAL_H |
| 3 | |
David Howells | 10b3a97 | 2012-10-09 09:47:06 +0100 | [diff] [blame] | 4 | #include <uapi/asm/signal.h> |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 5 | |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 6 | /* 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 | |
| 13 | typedef unsigned long old_sigset_t; /* at least 32 bits */ |
| 14 | |
| 15 | typedef struct { |
| 16 | unsigned long sig[_NSIG_WORDS]; |
| 17 | } sigset_t; |
| 18 | |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 19 | struct 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 Viro | 574c486 | 2012-11-25 22:24:19 -0500 | [diff] [blame^] | 26 | #define __ARCH_HAS_SA_RESTORER |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 27 | |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 28 | #include <asm/sigcontext.h> |
| 29 | |
Greg Ungerer | f3c23a2 | 2011-07-04 14:23:09 +1000 | [diff] [blame] | 30 | #ifndef CONFIG_CPU_HAS_NO_BITFIELDS |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 31 | #define __HAVE_ARCH_SIG_BITOPS |
| 32 | |
| 33 | static inline void sigaddset(sigset_t *set, int _sig) |
| 34 | { |
| 35 | asm ("bfset %0{%1,#1}" |
Andreas Schwab | 34fa78b | 2012-11-17 22:27:04 +0100 | [diff] [blame] | 36 | : "+o" (*set) |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 37 | : "id" ((_sig - 1) ^ 31) |
| 38 | : "cc"); |
| 39 | } |
| 40 | |
| 41 | static inline void sigdelset(sigset_t *set, int _sig) |
| 42 | { |
| 43 | asm ("bfclr %0{%1,#1}" |
Andreas Schwab | 34fa78b | 2012-11-17 22:27:04 +0100 | [diff] [blame] | 44 | : "+o" (*set) |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 45 | : "id" ((_sig - 1) ^ 31) |
| 46 | : "cc"); |
| 47 | } |
| 48 | |
| 49 | static 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 | |
| 55 | static inline int __gen_sigismember(sigset_t *set, int _sig) |
| 56 | { |
| 57 | int ret; |
| 58 | asm ("bfextu %1{%2,#1},%0" |
| 59 | : "=d" (ret) |
Andreas Schwab | 34fa78b | 2012-11-17 22:27:04 +0100 | [diff] [blame] | 60 | : "o" (*set), "id" ((_sig-1) ^ 31) |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 61 | : "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 | |
| 70 | static 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 Ungerer | f3c23a2 | 2011-07-04 14:23:09 +1000 | [diff] [blame] | 79 | #endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */ |
| 80 | |
Al Viro | 4f4202f | 2012-11-05 12:59:15 -0500 | [diff] [blame] | 81 | #ifndef __uClinux__ |
Al Viro | b7f9591 | 2012-11-05 13:06:22 -0500 | [diff] [blame] | 82 | extern void ptrace_signal_deliver(void); |
Al Viro | 4f4202f | 2012-11-05 12:59:15 -0500 | [diff] [blame] | 83 | #define ptrace_signal_deliver ptrace_signal_deliver |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 84 | #endif /* __uClinux__ */ |
Greg Ungerer | 8dba99e | 2009-03-16 22:10:08 +1000 | [diff] [blame] | 85 | |
| 86 | #endif /* _M68K_SIGNAL_H */ |