Paul Mundt | 03fdb70 | 2009-10-17 21:06:39 +0900 | [diff] [blame] | 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 | |
David Howells | df9ee29 | 2010-10-07 14:08:55 +0100 | [diff] [blame] | 13 | void notrace arch_local_irq_restore(unsigned long flags) |
Paul Mundt | 03fdb70 | 2009-10-17 21:06:39 +0900 | [diff] [blame] | 14 | { |
| 15 | unsigned long __dummy0, __dummy1; |
| 16 | |
David Howells | df9ee29 | 2010-10-07 14:08:55 +0100 | [diff] [blame] | 17 | if (flags == ARCH_IRQ_DISABLED) { |
Paul Mundt | 03fdb70 | 2009-10-17 21:06:39 +0900 | [diff] [blame] | 18 | __asm__ __volatile__ ( |
| 19 | "stc sr, %0\n\t" |
| 20 | "or #0xf0, %0\n\t" |
| 21 | "ldc %0, sr\n\t" |
| 22 | : "=&z" (__dummy0) |
| 23 | : /* no inputs */ |
| 24 | : "memory" |
| 25 | ); |
| 26 | } else { |
| 27 | __asm__ __volatile__ ( |
| 28 | "stc sr, %0\n\t" |
| 29 | "and %1, %0\n\t" |
| 30 | #ifdef CONFIG_CPU_HAS_SR_RB |
| 31 | "stc r6_bank, %1\n\t" |
| 32 | "or %1, %0\n\t" |
| 33 | #endif |
| 34 | "ldc %0, sr\n\t" |
| 35 | : "=&r" (__dummy0), "=r" (__dummy1) |
David Howells | df9ee29 | 2010-10-07 14:08:55 +0100 | [diff] [blame] | 36 | : "1" (~ARCH_IRQ_DISABLED) |
Paul Mundt | 03fdb70 | 2009-10-17 21:06:39 +0900 | [diff] [blame] | 37 | : "memory" |
| 38 | ); |
| 39 | } |
| 40 | } |
David Howells | df9ee29 | 2010-10-07 14:08:55 +0100 | [diff] [blame] | 41 | EXPORT_SYMBOL(arch_local_irq_restore); |
Paul Mundt | 03fdb70 | 2009-10-17 21:06:39 +0900 | [diff] [blame] | 42 | |
David Howells | df9ee29 | 2010-10-07 14:08:55 +0100 | [diff] [blame] | 43 | unsigned long notrace arch_local_save_flags(void) |
Paul Mundt | 03fdb70 | 2009-10-17 21:06:39 +0900 | [diff] [blame] | 44 | { |
| 45 | unsigned long flags; |
| 46 | |
| 47 | __asm__ __volatile__ ( |
| 48 | "stc sr, %0\n\t" |
| 49 | "and #0xf0, %0\n\t" |
| 50 | : "=&z" (flags) |
| 51 | : /* no inputs */ |
| 52 | : "memory" |
| 53 | ); |
| 54 | |
| 55 | return flags; |
| 56 | } |
David Howells | df9ee29 | 2010-10-07 14:08:55 +0100 | [diff] [blame] | 57 | EXPORT_SYMBOL(arch_local_save_flags); |