1 #ifndef __PARISC_SYSTEM_IRQSAVE_H
2 #define __PARISC_SYSTEM_IRQSAVE_H
3 
4 /* interrupt control */
5 #define __save_flags(x)	__asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory")
6 #define __restore_flags(x) __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory")
7 #define __cli()	__asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
8 #define __sti()	__asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
9 
10 #define __save_and_cli(x)  do { __save_flags(x); __cli(); } while(0);
11 #define __save_and_sti(x)  do { __save_flags(x); __sti(); } while(0);
12 
13 /* For spinlocks etc */
14 #if 0
15 #define local_irq_save(x) \
16 	__asm__ __volatile__("rsm %1,%0" : "=r" (x) :"i" (PSW_I) : "memory" )
17 #define local_irq_set(x) \
18 #       "Warning local_irq_set(x) is not yet defined"
19 #else
20 #define local_irq_save(x)  __save_and_cli(x)
21 #define local_irq_set(x)   __save_and_sti(x)
22 #endif
23 
24 #define local_irq_restore(x) __restore_flags(x)
25 #define local_irq_disable() __cli()
26 #define local_irq_enable()  __sti()
27 
28 #endif /* __PARISC_SYSTEM_IRQSAVE_H */
29