1 /* Portions taken from Linux arch arm */ 2 #ifndef __ASM_ARM32_SYSTEM_H 3 #define __ASM_ARM32_SYSTEM_H 4 5 #include <asm/arm32/cmpxchg.h> 6 7 #define local_irq_disable() asm volatile ( "cpsid i @ local_irq_disable\n" : : : "cc" ) 8 #define local_irq_enable() asm volatile ( "cpsie i @ local_irq_enable\n" : : : "cc" ) 9 10 #define local_save_flags(x) \ 11 ({ \ 12 BUILD_BUG_ON(sizeof(x) != sizeof(long)); \ 13 asm volatile ( "mrs %0, cpsr @ local_save_flags\n" \ 14 : "=r" (x) :: "memory", "cc" ); \ 15 }) 16 #define local_irq_save(x) \ 17 ({ \ 18 local_save_flags(x); \ 19 local_irq_disable(); \ 20 }) 21 #define local_irq_restore(x) \ 22 ({ \ 23 BUILD_BUG_ON(sizeof(x) != sizeof(long)); \ 24 asm volatile ( \ 25 "msr cpsr_c, %0 @ local_irq_restore\n" \ 26 : \ 27 : "r" (x) \ 28 : "memory", "cc"); \ 29 }) 30 local_irq_is_enabled(void)31static inline int local_irq_is_enabled(void) 32 { 33 unsigned long flags; 34 local_save_flags(flags); 35 return !(flags & PSR_IRQ_MASK); 36 } 37 38 #define local_fiq_enable() __asm__("cpsie f @ __stf\n" : : : "memory", "cc") 39 #define local_fiq_disable() __asm__("cpsid f @ __clf\n" : : : "memory", "cc") 40 41 #define local_abort_enable() __asm__("cpsie a @ __sta\n" : : : "memory", "cc") 42 #define local_abort_disable() __asm__("cpsid a @ __sta\n" : : : "memory", "cc") 43 local_fiq_is_enabled(void)44static inline int local_fiq_is_enabled(void) 45 { 46 unsigned long flags; 47 local_save_flags(flags); 48 return !(flags & PSR_FIQ_MASK); 49 } 50 51 #endif 52 /* 53 * Local variables: 54 * mode: C 55 * c-file-style: "BSD" 56 * c-basic-offset: 4 57 * indent-tabs-mode: nil 58 * End: 59 */ 60