1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * SHmedia irqflags support
4 *
5 * Copyright (C) 2006 - 2009 Paul Mundt
6 */
7 #include <linux/irqflags.h>
8 #include <linux/module.h>
9 #include <cpu/registers.h>
10
arch_local_irq_restore(unsigned long flags)11 void notrace arch_local_irq_restore(unsigned long flags)
12 {
13 unsigned long long __dummy;
14
15 if (flags == ARCH_IRQ_DISABLED) {
16 __asm__ __volatile__ (
17 "getcon " __SR ", %0\n\t"
18 "or %0, %1, %0\n\t"
19 "putcon %0, " __SR "\n\t"
20 : "=&r" (__dummy)
21 : "r" (ARCH_IRQ_DISABLED)
22 );
23 } else {
24 __asm__ __volatile__ (
25 "getcon " __SR ", %0\n\t"
26 "and %0, %1, %0\n\t"
27 "putcon %0, " __SR "\n\t"
28 : "=&r" (__dummy)
29 : "r" (~ARCH_IRQ_DISABLED)
30 );
31 }
32 }
33 EXPORT_SYMBOL(arch_local_irq_restore);
34
arch_local_save_flags(void)35 unsigned long notrace arch_local_save_flags(void)
36 {
37 unsigned long flags;
38
39 __asm__ __volatile__ (
40 "getcon " __SR ", %0\n\t"
41 "and %0, %1, %0"
42 : "=&r" (flags)
43 : "r" (ARCH_IRQ_DISABLED)
44 );
45
46 return flags;
47 }
48 EXPORT_SYMBOL(arch_local_save_flags);
49