1 #ifndef __ASM_ARM_IRQFLAGS_H
2 #define __ASM_ARM_IRQFLAGS_H
6 #include <asm/ptrace.h>
9 * CPU interrupt mask handling.
12 #define IRQMASK_REG_NAME_R "primask"
13 #define IRQMASK_REG_NAME_W "primask"
14 #define IRQMASK_I_BIT 1
16 #define IRQMASK_REG_NAME_R "cpsr"
17 #define IRQMASK_REG_NAME_W "cpsr_c"
18 #define IRQMASK_I_BIT PSR_I_BIT
21 #if __LINUX_ARM_ARCH__ >= 6
23 static inline unsigned long arch_local_irq_save(void)
28 " mrs %0, " IRQMASK_REG_NAME_R
" @ arch_local_irq_save\n"
30 : "=r" (flags
) : : "memory", "cc");
34 static inline void arch_local_irq_enable(void)
37 " cpsie i @ arch_local_irq_enable"
43 static inline void arch_local_irq_disable(void)
46 " cpsid i @ arch_local_irq_disable"
52 #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
53 #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
57 * Save the current interrupt enable state & disable IRQs
59 static inline unsigned long arch_local_irq_save(void)
61 unsigned long flags
, temp
;
64 " mrs %0, cpsr @ arch_local_irq_save\n"
67 : "=r" (flags
), "=r" (temp
)
76 static inline void arch_local_irq_enable(void)
80 " mrs %0, cpsr @ arch_local_irq_enable\n"
91 static inline void arch_local_irq_disable(void)
95 " mrs %0, cpsr @ arch_local_irq_disable\n"
106 #define local_fiq_enable() \
108 unsigned long temp; \
109 __asm__ __volatile__( \
110 "mrs %0, cpsr @ stf\n" \
111 " bic %0, %0, #64\n" \
121 #define local_fiq_disable() \
123 unsigned long temp; \
124 __asm__ __volatile__( \
125 "mrs %0, cpsr @ clf\n" \
126 " orr %0, %0, #64\n" \
136 * Save the current interrupt enable state.
138 static inline unsigned long arch_local_save_flags(void)
142 " mrs %0, " IRQMASK_REG_NAME_R
" @ local_save_flags"
143 : "=r" (flags
) : : "memory", "cc");
148 * restore saved IRQ & FIQ state
150 static inline void arch_local_irq_restore(unsigned long flags
)
153 " msr " IRQMASK_REG_NAME_W
", %0 @ local_irq_restore"
159 static inline int arch_irqs_disabled_flags(unsigned long flags
)
161 return flags
& IRQMASK_I_BIT
;
164 #endif /* ifdef __KERNEL__ */
165 #endif /* ifndef __ASM_ARM_IRQFLAGS_H */