fs: use kmem_cache_zalloc instead
[pv_ops_mirror.git] / include / asm-sh / irqflags.h
blob9dedc1b693e351b4db80b01157a445f3b1f17dc2
1 #ifndef __ASM_SH_IRQFLAGS_H
2 #define __ASM_SH_IRQFLAGS_H
4 static inline void raw_local_irq_enable(void)
6 unsigned long __dummy0, __dummy1;
8 __asm__ __volatile__ (
9 "stc sr, %0\n\t"
10 "and %1, %0\n\t"
11 #ifdef CONFIG_CPU_HAS_SR_RB
12 "stc r6_bank, %1\n\t"
13 "or %1, %0\n\t"
14 #endif
15 "ldc %0, sr\n\t"
16 : "=&r" (__dummy0), "=r" (__dummy1)
17 : "1" (~0x000000f0)
18 : "memory"
22 static inline void raw_local_irq_disable(void)
24 unsigned long flags;
26 __asm__ __volatile__ (
27 "stc sr, %0\n\t"
28 "or #0xf0, %0\n\t"
29 "ldc %0, sr\n\t"
30 : "=&z" (flags)
31 : /* no inputs */
32 : "memory"
36 static inline void set_bl_bit(void)
38 unsigned long __dummy0, __dummy1;
40 __asm__ __volatile__ (
41 "stc sr, %0\n\t"
42 "or %2, %0\n\t"
43 "and %3, %0\n\t"
44 "ldc %0, sr\n\t"
45 : "=&r" (__dummy0), "=r" (__dummy1)
46 : "r" (0x10000000), "r" (0xffffff0f)
47 : "memory"
51 static inline void clear_bl_bit(void)
53 unsigned long __dummy0, __dummy1;
55 __asm__ __volatile__ (
56 "stc sr, %0\n\t"
57 "and %2, %0\n\t"
58 "ldc %0, sr\n\t"
59 : "=&r" (__dummy0), "=r" (__dummy1)
60 : "1" (~0x10000000)
61 : "memory"
65 static inline unsigned long __raw_local_save_flags(void)
67 unsigned long flags;
69 __asm__ __volatile__ (
70 "stc sr, %0\n\t"
71 "and #0xf0, %0\n\t"
72 : "=&z" (flags)
73 : /* no inputs */
74 : "memory"
77 return flags;
80 #define raw_local_save_flags(flags) \
81 do { (flags) = __raw_local_save_flags(); } while (0)
83 static inline int raw_irqs_disabled_flags(unsigned long flags)
85 return (flags != 0);
88 static inline int raw_irqs_disabled(void)
90 unsigned long flags = __raw_local_save_flags();
92 return raw_irqs_disabled_flags(flags);
95 static inline unsigned long __raw_local_irq_save(void)
97 unsigned long flags, __dummy;
99 __asm__ __volatile__ (
100 "stc sr, %1\n\t"
101 "mov %1, %0\n\t"
102 "or #0xf0, %0\n\t"
103 "ldc %0, sr\n\t"
104 "mov %1, %0\n\t"
105 "and #0xf0, %0\n\t"
106 : "=&z" (flags), "=&r" (__dummy)
107 : /* no inputs */
108 : "memory"
111 return flags;
114 #define raw_local_irq_save(flags) \
115 do { (flags) = __raw_local_irq_save(); } while (0)
117 static inline void raw_local_irq_restore(unsigned long flags)
119 if ((flags & 0xf0) != 0xf0)
120 raw_local_irq_enable();
123 #endif /* __ASM_SH_IRQFLAGS_H */