2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Copyright (C) 2000 MIPS Technologies, Inc.
11 #ifndef _ASM_INTERRUPT_H
12 #define _ASM_INTERRUPT_H
14 #include <asm/hazards.h>
17 ".macro\tlocal_irq_enable\n\t"
25 "irq_enable_hazard\n\t"
29 static inline void local_irq_enable(void)
39 * For cli() we have to insert nops to make sure that the new value
40 * has actually arrived in the status register before the end of this
42 * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
46 ".macro\tlocal_irq_disable\n\t"
54 "irq_disable_hazard\n\t"
58 static inline void local_irq_disable(void)
68 ".macro\tlocal_save_flags flags\n\t"
71 "mfc0\t\\flags, $12\n\t"
75 #define local_save_flags(x) \
76 __asm__ __volatile__( \
77 "local_save_flags %0" \
81 ".macro\tlocal_irq_save result\n\t"
85 "mfc0\t\\result, $12\n\t"
86 "ori\t$1, \\result, 1\n\t"
90 "irq_disable_hazard\n\t"
94 #define local_irq_save(x) \
95 __asm__ __volatile__( \
96 "local_irq_save\t%0" \
102 ".macro\tlocal_irq_restore flags\n\t"
103 ".set\tnoreorder\n\t"
106 "andi\t\\flags, 1\n\t"
109 "or\t\\flags, $1\n\t"
110 "mtc0\t\\flags, $12\n\t"
111 "irq_disable_hazard\n\t"
116 #define local_irq_restore(flags) \
118 unsigned long __tmp1; \
120 __asm__ __volatile__( \
121 "local_irq_restore\t%0" \
127 #define irqs_disabled() \
129 unsigned long flags; \
130 local_save_flags(flags); \
134 #endif /* _ASM_INTERRUPT_H */