signal.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. struct sigaction {
  20. __sighandler_t sa_handler;
  21. unsigned long sa_flags;
  22. __sigrestore_t sa_restorer;
  23. sigset_t sa_mask; /* mask last for extensibility */
  24. };
  25. #include <asm/sigcontext.h>
  26. #ifndef CONFIG_CPU_HAS_NO_BITFIELDS
  27. #define __HAVE_ARCH_SIG_BITOPS
  28. static inline void sigaddset(sigset_t *set, int _sig)
  29. {
  30. asm ("bfset %0{%1,#1}"
  31. : "+o" (*set)
  32. : "id" ((_sig - 1) ^ 31)
  33. : "cc");
  34. }
  35. static inline void sigdelset(sigset_t *set, int _sig)
  36. {
  37. asm ("bfclr %0{%1,#1}"
  38. : "+o" (*set)
  39. : "id" ((_sig - 1) ^ 31)
  40. : "cc");
  41. }
  42. static 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. static inline int __gen_sigismember(sigset_t *set, int _sig)
  48. {
  49. int ret;
  50. asm ("bfextu %1{%2,#1},%0"
  51. : "=d" (ret)
  52. : "o" (*set), "id" ((_sig-1) ^ 31)
  53. : "cc");
  54. return ret;
  55. }
  56. #define sigismember(set,sig) \
  57. (__builtin_constant_p(sig) ? \
  58. __const_sigismember(set,sig) : \
  59. __gen_sigismember(set,sig))
  60. static inline int sigfindinword(unsigned long word)
  61. {
  62. asm ("bfffo %1{#0,#0},%0"
  63. : "=d" (word)
  64. : "d" (word & -word)
  65. : "cc");
  66. return word ^ 31;
  67. }
  68. #endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */
  69. #ifndef __uClinux__
  70. extern void ptrace_signal_deliver(void);
  71. #define ptrace_signal_deliver ptrace_signal_deliver
  72. #endif /* __uClinux__ */
  73. #endif /* _M68K_SIGNAL_H */