aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/irqflags_32.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/irqflags_32.h')
-rw-r--r--include/asm-x86/irqflags_32.h195
1 files changed, 0 insertions, 195 deletions
diff --git a/include/asm-x86/irqflags_32.h b/include/asm-x86/irqflags_32.h
deleted file mode 100644
index 98b21b9bdce8..000000000000
--- a/include/asm-x86/irqflags_32.h
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2 * IRQ flags handling
3 *
4 * This file gets included from lowlevel asm headers too, to provide
5 * wrapped versions of the local_irq_*() APIs, based on the
6 * raw_local_irq_*() functions from the lowlevel headers.
7 */
8#ifndef _ASM_IRQFLAGS_H
9#define _ASM_IRQFLAGS_H
10#include <asm/processor-flags.h>
11
12#ifndef __ASSEMBLY__
13static inline unsigned long native_save_fl(void)
14{
15 unsigned long f;
16 asm volatile("pushfl ; popl %0":"=g" (f): /* no input */);
17 return f;
18}
19
20static inline void native_restore_fl(unsigned long f)
21{
22 asm volatile("pushl %0 ; popfl": /* no output */
23 :"g" (f)
24 :"memory", "cc");
25}
26
27static inline void native_irq_disable(void)
28{
29 asm volatile("cli": : :"memory");
30}
31
32static inline void native_irq_enable(void)
33{
34 asm volatile("sti": : :"memory");
35}
36
37static inline void native_safe_halt(void)
38{
39 asm volatile("sti; hlt": : :"memory");
40}
41
42static inline void native_halt(void)
43{
44 asm volatile("hlt": : :"memory");
45}
46#endif /* __ASSEMBLY__ */
47
48#ifdef CONFIG_PARAVIRT
49#include <asm/paravirt.h>
50#else
51#ifndef __ASSEMBLY__
52
53static inline unsigned long __raw_local_save_flags(void)
54{
55 return native_save_fl();
56}
57
58static inline void raw_local_irq_restore(unsigned long flags)
59{
60 native_restore_fl(flags);
61}
62
63static inline void raw_local_irq_disable(void)
64{
65 native_irq_disable();
66}
67
68static inline void raw_local_irq_enable(void)
69{
70 native_irq_enable();
71}
72
73/*
74 * Used in the idle loop; sti takes one instruction cycle
75 * to complete:
76 */
77static inline void raw_safe_halt(void)
78{
79 native_safe_halt();
80}
81
82/*
83 * Used when interrupts are already enabled or to
84 * shutdown the processor:
85 */
86static inline void halt(void)
87{
88 native_halt();
89}
90
91/*
92 * For spinlocks, etc:
93 */
94static inline unsigned long __raw_local_irq_save(void)
95{
96 unsigned long flags = __raw_local_save_flags();
97
98 raw_local_irq_disable();
99
100 return flags;
101}
102
103#else
104#define DISABLE_INTERRUPTS(clobbers) cli
105#define ENABLE_INTERRUPTS(clobbers) sti
106#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
107#define INTERRUPT_RETURN iret
108#define GET_CR0_INTO_EAX movl %cr0, %eax
109#endif /* __ASSEMBLY__ */
110#endif /* CONFIG_PARAVIRT */
111
112#ifndef __ASSEMBLY__
113#define raw_local_save_flags(flags) \
114 do { (flags) = __raw_local_save_flags(); } while (0)
115
116#define raw_local_irq_save(flags) \
117 do { (flags) = __raw_local_irq_save(); } while (0)
118
119static inline int raw_irqs_disabled_flags(unsigned long flags)
120{
121 return !(flags & X86_EFLAGS_IF);
122}
123
124static inline int raw_irqs_disabled(void)
125{
126 unsigned long flags = __raw_local_save_flags();
127
128 return raw_irqs_disabled_flags(flags);
129}
130
131/*
132 * makes the traced hardirq state match with the machine state
133 *
134 * should be a rarely used function, only in places where its
135 * otherwise impossible to know the irq state, like in traps.
136 */
137static inline void trace_hardirqs_fixup_flags(unsigned long flags)
138{
139 if (raw_irqs_disabled_flags(flags))
140 trace_hardirqs_off();
141 else
142 trace_hardirqs_on();
143}
144
145static inline void trace_hardirqs_fixup(void)
146{
147 unsigned long flags = __raw_local_save_flags();
148
149 trace_hardirqs_fixup_flags(flags);
150}
151#endif /* __ASSEMBLY__ */
152
153/*
154 * Do the CPU's IRQ-state tracing from assembly code. We call a
155 * C function, so save all the C-clobbered registers:
156 */
157#ifdef CONFIG_TRACE_IRQFLAGS
158
159# define TRACE_IRQS_ON \
160 pushl %eax; \
161 pushl %ecx; \
162 pushl %edx; \
163 call trace_hardirqs_on; \
164 popl %edx; \
165 popl %ecx; \
166 popl %eax;
167
168# define TRACE_IRQS_OFF \
169 pushl %eax; \
170 pushl %ecx; \
171 pushl %edx; \
172 call trace_hardirqs_off; \
173 popl %edx; \
174 popl %ecx; \
175 popl %eax;
176
177#else
178# define TRACE_IRQS_ON
179# define TRACE_IRQS_OFF
180#endif
181
182#ifdef CONFIG_DEBUG_LOCK_ALLOC
183# define LOCKDEP_SYS_EXIT \
184 pushl %eax; \
185 pushl %ecx; \
186 pushl %edx; \
187 call lockdep_sys_exit; \
188 popl %edx; \
189 popl %ecx; \
190 popl %eax;
191#else
192# define LOCKDEP_SYS_EXIT
193#endif
194
195#endif