irqflags.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * linux/arch/unicore32/include/asm/irqflags.h
  3. *
  4. * Code specific to PKUnity SoC and UniCore ISA
  5. *
  6. * Copyright (C) 2001-2010 GUAN Xue-tao
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __UNICORE_IRQFLAGS_H__
  13. #define __UNICORE_IRQFLAGS_H__
  14. #ifdef __KERNEL__
  15. #include <asm/ptrace.h>
  16. #define ARCH_IRQ_DISABLED (PRIV_MODE | PSR_I_BIT)
  17. #define ARCH_IRQ_ENABLED (PRIV_MODE)
  18. /*
  19. * Save the current interrupt enable state.
  20. */
  21. static inline unsigned long arch_local_save_flags(void)
  22. {
  23. unsigned long temp;
  24. asm volatile("mov %0, asr" : "=r" (temp) : : "memory", "cc");
  25. return temp & PSR_c;
  26. }
  27. /*
  28. * restore saved IRQ state
  29. */
  30. static inline void arch_local_irq_restore(unsigned long flags)
  31. {
  32. unsigned long temp;
  33. asm volatile(
  34. "mov %0, asr\n"
  35. "mov.a asr, %1\n"
  36. "mov.f asr, %0"
  37. : "=&r" (temp)
  38. : "r" (flags)
  39. : "memory", "cc");
  40. }
  41. #include <asm-generic/irqflags.h>
  42. #endif
  43. #endif