2 * include/asm-i386/irqflags.h
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
10 #ifndef _ASM_IRQFLAGS_H
11 #define _ASM_IRQFLAGS_H
13 #ifdef CONFIG_PARAVIRT
14 #include <asm/paravirt.h>
18 static inline unsigned long __raw_local_save_flags(void)
31 static inline void raw_local_irq_restore(unsigned long flags
)
41 static inline void raw_local_irq_disable(void)
43 __asm__
__volatile__("cli" : : : "memory");
46 static inline void raw_local_irq_enable(void)
48 __asm__
__volatile__("sti" : : : "memory");
52 * Used in the idle loop; sti takes one instruction cycle
55 static inline void raw_safe_halt(void)
57 __asm__
__volatile__("sti; hlt" : : : "memory");
61 * Used when interrupts are already enabled or to
62 * shutdown the processor:
64 static inline void halt(void)
66 __asm__
__volatile__("hlt": : :"memory");
72 static inline unsigned long __raw_local_irq_save(void)
74 unsigned long flags
= __raw_local_save_flags();
76 raw_local_irq_disable();
82 #define DISABLE_INTERRUPTS(clobbers) cli
83 #define ENABLE_INTERRUPTS(clobbers) sti
84 #define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
85 #define INTERRUPT_RETURN iret
86 #define GET_CR0_INTO_EAX movl %cr0, %eax
87 #endif /* __ASSEMBLY__ */
88 #endif /* CONFIG_PARAVIRT */
91 #define raw_local_save_flags(flags) \
92 do { (flags) = __raw_local_save_flags(); } while (0)
94 #define raw_local_irq_save(flags) \
95 do { (flags) = __raw_local_irq_save(); } while (0)
97 static inline int raw_irqs_disabled_flags(unsigned long flags
)
99 return !(flags
& (1 << 9));
102 static inline int raw_irqs_disabled(void)
104 unsigned long flags
= __raw_local_save_flags();
106 return raw_irqs_disabled_flags(flags
);
108 #endif /* __ASSEMBLY__ */
111 * Do the CPU's IRQ-state tracing from assembly code. We call a
112 * C function, so save all the C-clobbered registers:
114 #ifdef CONFIG_TRACE_IRQFLAGS
116 # define TRACE_IRQS_ON \
120 call trace_hardirqs_on; \
125 # define TRACE_IRQS_OFF \
129 call trace_hardirqs_off; \
135 # define TRACE_IRQS_ON
136 # define TRACE_IRQS_OFF