signal.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef _M68K_SIGNAL_H
  2. #define _M68K_SIGNAL_H
  3. #include <uapi/asm/signal.h>
  4. /* Most things should be clean enough to redefine this at will, if care
  5. is taken to make libc match. */
  6. #define _NSIG 64
  7. #define _NSIG_BPW 32
  8. #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
  9. typedef unsigned long old_sigset_t; /* at least 32 bits */
  10. typedef struct {
  11. unsigned long sig[_NSIG_WORDS];
  12. } sigset_t;
  13. struct old_sigaction {
  14. __sighandler_t sa_handler;
  15. old_sigset_t sa_mask;
  16. unsigned long sa_flags;
  17. __sigrestore_t sa_restorer;
  18. };
  19. #define __ARCH_HAS_SA_RESTORER
  20. #include <asm/sigcontext.h>
  21. #ifndef CONFIG_CPU_HAS_NO_BITFIELDS
  22. #define __HAVE_ARCH_SIG_BITOPS
  23. static inline void sigaddset(sigset_t *set, int _sig)
  24. {
  25. asm ("bfset %0{%1,#1}"
  26. : "+o" (*set)
  27. : "id" ((_sig - 1) ^ 31)
  28. : "cc");
  29. }
  30. static inline void sigdelset(sigset_t *set, int _sig)
  31. {
  32. asm ("bfclr %0{%1,#1}"
  33. : "+o" (*set)
  34. : "id" ((_sig - 1) ^ 31)
  35. : "cc");
  36. }
  37. static inline int __const_sigismember(sigset_t *set, int _sig)
  38. {
  39. unsigned long sig = _sig - 1;
  40. return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
  41. }
  42. static inline int __gen_sigismember(sigset_t *set, int _sig)
  43. {
  44. int ret;
  45. asm ("bfextu %1{%2,#1},%0"
  46. : "=d" (ret)
  47. : "o" (*set), "id" ((_sig-1) ^ 31)
  48. : "cc");
  49. return ret;
  50. }
  51. #define sigismember(set,sig) \
  52. (__builtin_constant_p(sig) ? \
  53. __const_sigismember(set,sig) : \
  54. __gen_sigismember(set,sig))
  55. static inline int sigfindinword(unsigned long word)
  56. {
  57. asm ("bfffo %1{#0,#0},%0"
  58. : "=d" (word)
  59. : "d" (word & -word)
  60. : "cc");
  61. return word ^ 31;
  62. }
  63. #endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */
  64. #ifndef __uClinux__
  65. extern void ptrace_signal_deliver(void);
  66. #define ptrace_signal_deliver ptrace_signal_deliver
  67. #endif /* __uClinux__ */
  68. #endif /* _M68K_SIGNAL_H */