x86: Fix compilation bug in kprobes' twobyte_is_boostable
[linux-btrfs-devel.git] / arch / arm / include / asm / irqflags.h
blob1e6cca55c750486b98ef85ca5a04c9af471d64ea
1 #ifndef __ASM_ARM_IRQFLAGS_H
2 #define __ASM_ARM_IRQFLAGS_H
4 #ifdef __KERNEL__
6 #include <asm/ptrace.h>
8 /*
9 * CPU interrupt mask handling.
11 #if __LINUX_ARM_ARCH__ >= 6
13 static inline unsigned long arch_local_irq_save(void)
15 unsigned long flags;
17 asm volatile(
18 " mrs %0, cpsr @ arch_local_irq_save\n"
19 " cpsid i"
20 : "=r" (flags) : : "memory", "cc");
21 return flags;
24 static inline void arch_local_irq_enable(void)
26 asm volatile(
27 " cpsie i @ arch_local_irq_enable"
30 : "memory", "cc");
33 static inline void arch_local_irq_disable(void)
35 asm volatile(
36 " cpsid i @ arch_local_irq_disable"
39 : "memory", "cc");
42 #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
43 #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
44 #else
47 * Save the current interrupt enable state & disable IRQs
49 static inline unsigned long arch_local_irq_save(void)
51 unsigned long flags, temp;
53 asm volatile(
54 " mrs %0, cpsr @ arch_local_irq_save\n"
55 " orr %1, %0, #128\n"
56 " msr cpsr_c, %1"
57 : "=r" (flags), "=r" (temp)
59 : "memory", "cc");
60 return flags;
64 * Enable IRQs
66 static inline void arch_local_irq_enable(void)
68 unsigned long temp;
69 asm volatile(
70 " mrs %0, cpsr @ arch_local_irq_enable\n"
71 " bic %0, %0, #128\n"
72 " msr cpsr_c, %0"
73 : "=r" (temp)
75 : "memory", "cc");
79 * Disable IRQs
81 static inline void arch_local_irq_disable(void)
83 unsigned long temp;
84 asm volatile(
85 " mrs %0, cpsr @ arch_local_irq_disable\n"
86 " orr %0, %0, #128\n"
87 " msr cpsr_c, %0"
88 : "=r" (temp)
90 : "memory", "cc");
94 * Enable FIQs
96 #define local_fiq_enable() \
97 ({ \
98 unsigned long temp; \
99 __asm__ __volatile__( \
100 "mrs %0, cpsr @ stf\n" \
101 " bic %0, %0, #64\n" \
102 " msr cpsr_c, %0" \
103 : "=r" (temp) \
105 : "memory", "cc"); \
109 * Disable FIQs
111 #define local_fiq_disable() \
112 ({ \
113 unsigned long temp; \
114 __asm__ __volatile__( \
115 "mrs %0, cpsr @ clf\n" \
116 " orr %0, %0, #64\n" \
117 " msr cpsr_c, %0" \
118 : "=r" (temp) \
120 : "memory", "cc"); \
123 #endif
126 * Save the current interrupt enable state.
128 static inline unsigned long arch_local_save_flags(void)
130 unsigned long flags;
131 asm volatile(
132 " mrs %0, cpsr @ local_save_flags"
133 : "=r" (flags) : : "memory", "cc");
134 return flags;
138 * restore saved IRQ & FIQ state
140 static inline void arch_local_irq_restore(unsigned long flags)
142 asm volatile(
143 " msr cpsr_c, %0 @ local_irq_restore"
145 : "r" (flags)
146 : "memory", "cc");
149 static inline int arch_irqs_disabled_flags(unsigned long flags)
151 return flags & PSR_I_BIT;
154 #endif
155 #endif