irq_32.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * SHcompact 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. void notrace arch_local_irq_restore(unsigned long flags)
  13. {
  14. unsigned long __dummy0, __dummy1;
  15. if (flags == ARCH_IRQ_DISABLED) {
  16. __asm__ __volatile__ (
  17. "stc sr, %0\n\t"
  18. "or #0xf0, %0\n\t"
  19. "ldc %0, sr\n\t"
  20. : "=&z" (__dummy0)
  21. : /* no inputs */
  22. : "memory"
  23. );
  24. } else {
  25. __asm__ __volatile__ (
  26. "stc sr, %0\n\t"
  27. "and %1, %0\n\t"
  28. #ifdef CONFIG_CPU_HAS_SR_RB
  29. "stc r6_bank, %1\n\t"
  30. "or %1, %0\n\t"
  31. #endif
  32. "ldc %0, sr\n\t"
  33. : "=&r" (__dummy0), "=r" (__dummy1)
  34. : "1" (~ARCH_IRQ_DISABLED)
  35. : "memory"
  36. );
  37. }
  38. }
  39. EXPORT_SYMBOL(arch_local_irq_restore);
  40. unsigned long notrace arch_local_save_flags(void)
  41. {
  42. unsigned long flags;
  43. __asm__ __volatile__ (
  44. "stc sr, %0\n\t"
  45. "and #0xf0, %0\n\t"
  46. : "=&z" (flags)
  47. : /* no inputs */
  48. : "memory"
  49. );
  50. return flags;
  51. }
  52. EXPORT_SYMBOL(arch_local_save_flags);