irq_64.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * SHmedia irqflags support
  3. *
  4. * Copyright (C) 2006 - 2009 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/irqflags.h>
  11. #include <linux/module.h>
  12. #include <cpu/registers.h>
  13. void notrace arch_local_irq_restore(unsigned long flags)
  14. {
  15. unsigned long long __dummy;
  16. if (flags == ARCH_IRQ_DISABLED) {
  17. __asm__ __volatile__ (
  18. "getcon " __SR ", %0\n\t"
  19. "or %0, %1, %0\n\t"
  20. "putcon %0, " __SR "\n\t"
  21. : "=&r" (__dummy)
  22. : "r" (ARCH_IRQ_DISABLED)
  23. );
  24. } else {
  25. __asm__ __volatile__ (
  26. "getcon " __SR ", %0\n\t"
  27. "and %0, %1, %0\n\t"
  28. "putcon %0, " __SR "\n\t"
  29. : "=&r" (__dummy)
  30. : "r" (~ARCH_IRQ_DISABLED)
  31. );
  32. }
  33. }
  34. EXPORT_SYMBOL(arch_local_irq_restore);
  35. unsigned long notrace arch_local_save_flags(void)
  36. {
  37. unsigned long flags;
  38. __asm__ __volatile__ (
  39. "getcon " __SR ", %0\n\t"
  40. "and %0, %1, %0"
  41. : "=&r" (flags)
  42. : "r" (ARCH_IRQ_DISABLED)
  43. );
  44. return flags;
  45. }
  46. EXPORT_SYMBOL(arch_local_save_flags);