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