1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * linux/arch/unicore32/include/asm/irqflags.h 4 * 5 * Code specific to PKUnity SoC and UniCore ISA 6 * 7 * Copyright (C) 2001-2010 GUAN Xue-tao 8 */ 9 #ifndef __UNICORE_IRQFLAGS_H__ 10 #define __UNICORE_IRQFLAGS_H__ 11 12 #ifdef __KERNEL__ 13 14 #include <asm/ptrace.h> 15 16 #define ARCH_IRQ_DISABLED (PRIV_MODE | PSR_I_BIT) 17 #define ARCH_IRQ_ENABLED (PRIV_MODE) 18 19 /* 20 * Save the current interrupt enable state. 21 */ arch_local_save_flags(void)22static inline unsigned long arch_local_save_flags(void) 23 { 24 unsigned long temp; 25 26 asm volatile("mov %0, asr" : "=r" (temp) : : "memory", "cc"); 27 28 return temp & PSR_c; 29 } 30 31 /* 32 * restore saved IRQ state 33 */ arch_local_irq_restore(unsigned long flags)34static inline void arch_local_irq_restore(unsigned long flags) 35 { 36 unsigned long temp; 37 38 asm volatile( 39 "mov %0, asr\n" 40 "mov.a asr, %1\n" 41 "mov.f asr, %0" 42 : "=&r" (temp) 43 : "r" (flags) 44 : "memory", "cc"); 45 } 46 47 #include <asm-generic/irqflags.h> 48 49 #endif 50 #endif 51