irqflags_64.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef __ASM_SH_IRQFLAGS_64_H
  2. #define __ASM_SH_IRQFLAGS_64_H
  3. #include <cpu/registers.h>
  4. #define SR_MASK_LL 0x00000000000000f0LL
  5. #define SR_BL_LL 0x0000000010000000LL
  6. static inline void raw_local_irq_enable(void)
  7. {
  8. unsigned long long __dummy0, __dummy1 = ~SR_MASK_LL;
  9. __asm__ __volatile__("getcon " __SR ", %0\n\t"
  10. "and %0, %1, %0\n\t"
  11. "putcon %0, " __SR "\n\t"
  12. : "=&r" (__dummy0)
  13. : "r" (__dummy1));
  14. }
  15. static inline void raw_local_irq_disable(void)
  16. {
  17. unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
  18. __asm__ __volatile__("getcon " __SR ", %0\n\t"
  19. "or %0, %1, %0\n\t"
  20. "putcon %0, " __SR "\n\t"
  21. : "=&r" (__dummy0)
  22. : "r" (__dummy1));
  23. }
  24. static inline void set_bl_bit(void)
  25. {
  26. unsigned long long __dummy0, __dummy1 = SR_BL_LL;
  27. __asm__ __volatile__("getcon " __SR ", %0\n\t"
  28. "or %0, %1, %0\n\t"
  29. "putcon %0, " __SR "\n\t"
  30. : "=&r" (__dummy0)
  31. : "r" (__dummy1));
  32. }
  33. static inline void clear_bl_bit(void)
  34. {
  35. unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
  36. __asm__ __volatile__("getcon " __SR ", %0\n\t"
  37. "and %0, %1, %0\n\t"
  38. "putcon %0, " __SR "\n\t"
  39. : "=&r" (__dummy0)
  40. : "r" (__dummy1));
  41. }
  42. static inline unsigned long __raw_local_save_flags(void)
  43. {
  44. unsigned long long __dummy = SR_MASK_LL;
  45. unsigned long flags;
  46. __asm__ __volatile__ (
  47. "getcon " __SR ", %0\n\t"
  48. "and %0, %1, %0"
  49. : "=&r" (flags)
  50. : "r" (__dummy));
  51. return flags;
  52. }
  53. static inline unsigned long __raw_local_irq_save(void)
  54. {
  55. unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
  56. unsigned long flags;
  57. __asm__ __volatile__ (
  58. "getcon " __SR ", %1\n\t"
  59. "or %1, r63, %0\n\t"
  60. "or %1, %2, %1\n\t"
  61. "putcon %1, " __SR "\n\t"
  62. "and %0, %2, %0"
  63. : "=&r" (flags), "=&r" (__dummy0)
  64. : "r" (__dummy1));
  65. return flags;
  66. }
  67. #endif /* __ASM_SH_IRQFLAGS_64_H */