signal.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. struct k_sigaction {
  26. struct sigaction sa;
  27. };
  28. #include <asm/sigcontext.h>
  29. #ifndef CONFIG_CPU_HAS_NO_BITFIELDS
  30. #define __HAVE_ARCH_SIG_BITOPS
  31. static inline void sigaddset(sigset_t *set, int _sig)
  32. {
  33. asm ("bfset %0{%1,#1}"
  34. : "+o" (*set)
  35. : "id" ((_sig - 1) ^ 31)
  36. : "cc");
  37. }
  38. static inline void sigdelset(sigset_t *set, int _sig)
  39. {
  40. asm ("bfclr %0{%1,#1}"
  41. : "+o" (*set)
  42. : "id" ((_sig - 1) ^ 31)
  43. : "cc");
  44. }
  45. static inline int __const_sigismember(sigset_t *set, int _sig)
  46. {
  47. unsigned long sig = _sig - 1;
  48. return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
  49. }
  50. static inline int __gen_sigismember(sigset_t *set, int _sig)
  51. {
  52. int ret;
  53. asm ("bfextu %1{%2,#1},%0"
  54. : "=d" (ret)
  55. : "o" (*set), "id" ((_sig-1) ^ 31)
  56. : "cc");
  57. return ret;
  58. }
  59. #define sigismember(set,sig) \
  60. (__builtin_constant_p(sig) ? \
  61. __const_sigismember(set,sig) : \
  62. __gen_sigismember(set,sig))
  63. static inline int sigfindinword(unsigned long word)
  64. {
  65. asm ("bfffo %1{#0,#0},%0"
  66. : "=d" (word)
  67. : "d" (word & -word)
  68. : "cc");
  69. return word ^ 31;
  70. }
  71. #endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */
  72. #ifdef __uClinux__
  73. #define ptrace_signal_deliver(regs, cookie) do { } while (0)
  74. #else
  75. struct pt_regs;
  76. extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
  77. #endif /* __uClinux__ */
  78. #endif /* _M68K_SIGNAL_H */