WIP FPC-III support
[linux/fpc-iii.git] / arch / sh / kernel / irq_32.c
blobe09cdc4ada68c8cb2593568396d1af8eac1be9bf
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * SHcompact irqflags support
5 * Copyright (C) 2006 - 2009 Paul Mundt
6 */
7 #include <linux/irqflags.h>
8 #include <linux/module.h>
10 void notrace arch_local_irq_restore(unsigned long flags)
12 unsigned long __dummy0, __dummy1;
14 if (flags == ARCH_IRQ_DISABLED) {
15 __asm__ __volatile__ (
16 "stc sr, %0\n\t"
17 "or #0xf0, %0\n\t"
18 "ldc %0, sr\n\t"
19 : "=&z" (__dummy0)
20 : /* no inputs */
21 : "memory"
23 } else {
24 __asm__ __volatile__ (
25 "stc sr, %0\n\t"
26 "and %1, %0\n\t"
27 #ifdef CONFIG_CPU_HAS_SR_RB
28 "stc r6_bank, %1\n\t"
29 "or %1, %0\n\t"
30 #endif
31 "ldc %0, sr\n\t"
32 : "=&r" (__dummy0), "=r" (__dummy1)
33 : "1" (~ARCH_IRQ_DISABLED)
34 : "memory"
38 EXPORT_SYMBOL(arch_local_irq_restore);
40 unsigned long notrace arch_local_save_flags(void)
42 unsigned long flags;
44 __asm__ __volatile__ (
45 "stc sr, %0\n\t"
46 "and #0xf0, %0\n\t"
47 : "=&z" (flags)
48 : /* no inputs */
49 : "memory"
52 return flags;
54 EXPORT_SYMBOL(arch_local_save_flags);