2 * include/asm-x86_64/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
18 static inline unsigned long __raw_local_save_flags(void)
23 "# __raw_save_flags\n\t"
33 #define raw_local_save_flags(flags) \
34 do { (flags) = __raw_local_save_flags(); } while (0)
36 static inline void raw_local_irq_restore(unsigned long flags
)
46 #ifdef CONFIG_X86_VSMP
49 * Interrupt control for the VSMP architecture:
52 static inline void raw_local_irq_disable(void)
54 unsigned long flags
= __raw_local_save_flags();
56 raw_local_irq_restore((flags
& ~(1 << 9)) | (1 << 18));
59 static inline void raw_local_irq_enable(void)
61 unsigned long flags
= __raw_local_save_flags();
63 raw_local_irq_restore((flags
| (1 << 9)) & ~(1 << 18));
66 static inline int raw_irqs_disabled_flags(unsigned long flags
)
68 return !(flags
& (1<<9)) || (flags
& (1 << 18));
71 #else /* CONFIG_X86_VSMP */
73 static inline void raw_local_irq_disable(void)
75 __asm__
__volatile__("cli" : : : "memory");
78 static inline void raw_local_irq_enable(void)
80 __asm__
__volatile__("sti" : : : "memory");
83 static inline int raw_irqs_disabled_flags(unsigned long flags
)
85 return !(flags
& (1 << 9));
91 * For spinlocks, etc.:
94 static inline unsigned long __raw_local_irq_save(void)
96 unsigned long flags
= __raw_local_save_flags();
98 raw_local_irq_disable();
103 #define raw_local_irq_save(flags) \
104 do { (flags) = __raw_local_irq_save(); } while (0)
106 static inline int raw_irqs_disabled(void)
108 unsigned long flags
= __raw_local_save_flags();
110 return raw_irqs_disabled_flags(flags
);
114 * Used in the idle loop; sti takes one instruction cycle
117 static inline void raw_safe_halt(void)
119 __asm__
__volatile__("sti; hlt" : : : "memory");
123 * Used when interrupts are already enabled or to
124 * shutdown the processor:
126 static inline void halt(void)
128 __asm__
__volatile__("hlt": : :"memory");
131 #else /* __ASSEMBLY__: */
132 # ifdef CONFIG_TRACE_IRQFLAGS
133 # define TRACE_IRQS_ON call trace_hardirqs_on_thunk
134 # define TRACE_IRQS_OFF call trace_hardirqs_off_thunk
136 # define TRACE_IRQS_ON
137 # define TRACE_IRQS_OFF