signal.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _M68K_SIGNAL_H
  3. #define _M68K_SIGNAL_H
  4. #include <uapi/asm/signal.h>
  5. /* Most things should be clean enough to redefine this at will, if care
  6. is taken to make libc match. */
  7. #define _NSIG 64
  8. #define _NSIG_BPW 32
  9. #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
  10. typedef unsigned long old_sigset_t; /* at least 32 bits */
  11. typedef struct {
  12. unsigned long sig[_NSIG_WORDS];
  13. } sigset_t;
  14. #define __ARCH_HAS_SA_RESTORER
  15. #include <asm/sigcontext.h>
  16. #ifndef CONFIG_CPU_HAS_NO_BITFIELDS
  17. #define __HAVE_ARCH_SIG_BITOPS
  18. static inline void sigaddset(sigset_t *set, int _sig)
  19. {
  20. asm ("bfset %0{%1,#1}"
  21. : "+o" (*set)
  22. : "id" ((_sig - 1) ^ 31)
  23. : "cc");
  24. }
  25. static inline void sigdelset(sigset_t *set, int _sig)
  26. {
  27. asm ("bfclr %0{%1,#1}"
  28. : "+o" (*set)
  29. : "id" ((_sig - 1) ^ 31)
  30. : "cc");
  31. }
  32. static inline int __const_sigismember(sigset_t *set, int _sig)
  33. {
  34. unsigned long sig = _sig - 1;
  35. return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
  36. }
  37. static inline int __gen_sigismember(sigset_t *set, int _sig)
  38. {
  39. int ret;
  40. asm ("bfextu %1{%2,#1},%0"
  41. : "=d" (ret)
  42. : "o" (*set), "id" ((_sig-1) ^ 31)
  43. : "cc");
  44. return ret;
  45. }
  46. #define sigismember(set,sig) \
  47. (__builtin_constant_p(sig) ? \
  48. __const_sigismember(set,sig) : \
  49. __gen_sigismember(set,sig))
  50. #endif /* !CONFIG_CPU_HAS_NO_BITFIELDS */
  51. #endif /* _M68K_SIGNAL_H */