irqflags_32.h 987 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * include/asm/irqflags.h
  3. *
  4. * IRQ flags handling
  5. *
  6. * This file gets included from lowlevel asm headers too, to provide
  7. * wrapped versions of the local_irq_*() APIs, based on the
  8. * arch_local_irq_*() functions from the lowlevel headers.
  9. */
  10. #ifndef _ASM_IRQFLAGS_H
  11. #define _ASM_IRQFLAGS_H
  12. #ifndef __ASSEMBLY__
  13. #include <linux/types.h>
  14. extern void arch_local_irq_restore(unsigned long);
  15. extern unsigned long arch_local_irq_save(void);
  16. extern void arch_local_irq_enable(void);
  17. static inline unsigned long arch_local_save_flags(void)
  18. {
  19. unsigned long flags;
  20. asm volatile("rd %%psr, %0" : "=r" (flags));
  21. return flags;
  22. }
  23. static inline void arch_local_irq_disable(void)
  24. {
  25. arch_local_irq_save();
  26. }
  27. static inline bool arch_irqs_disabled_flags(unsigned long flags)
  28. {
  29. return (flags & PSR_PIL) != 0;
  30. }
  31. static inline bool arch_irqs_disabled(void)
  32. {
  33. return arch_irqs_disabled_flags(arch_local_save_flags());
  34. }
  35. #endif /* (__ASSEMBLY__) */
  36. #endif /* !(_ASM_IRQFLAGS_H) */