Commit | Line | Data |
---|---|---|
03fdb708 PM |
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 | ||
31b37c73 | 14 | void notrace arch_local_irq_restore(unsigned long flags) |
03fdb708 PM |
15 | { |
16 | unsigned long long __dummy; | |
17 | ||
31b37c73 | 18 | if (flags == ARCH_IRQ_DISABLED) { |
03fdb708 PM |
19 | __asm__ __volatile__ ( |
20 | "getcon " __SR ", %0\n\t" | |
21 | "or %0, %1, %0\n\t" | |
22 | "putcon %0, " __SR "\n\t" | |
23 | : "=&r" (__dummy) | |
31b37c73 | 24 | : "r" (ARCH_IRQ_DISABLED) |
03fdb708 PM |
25 | ); |
26 | } else { | |
27 | __asm__ __volatile__ ( | |
28 | "getcon " __SR ", %0\n\t" | |
29 | "and %0, %1, %0\n\t" | |
30 | "putcon %0, " __SR "\n\t" | |
31 | : "=&r" (__dummy) | |
31b37c73 | 32 | : "r" (~ARCH_IRQ_DISABLED) |
03fdb708 PM |
33 | ); |
34 | } | |
35 | } | |
31b37c73 | 36 | EXPORT_SYMBOL(arch_local_irq_restore); |
03fdb708 | 37 | |
31b37c73 | 38 | unsigned long notrace arch_local_save_flags(void) |
03fdb708 PM |
39 | { |
40 | unsigned long flags; | |
41 | ||
42 | __asm__ __volatile__ ( | |
43 | "getcon " __SR ", %0\n\t" | |
44 | "and %0, %1, %0" | |
45 | : "=&r" (flags) | |
31b37c73 | 46 | : "r" (ARCH_IRQ_DISABLED) |
03fdb708 PM |
47 | ); |
48 | ||
49 | return flags; | |
50 | } | |
31b37c73 | 51 | EXPORT_SYMBOL(arch_local_save_flags); |