aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/irqflags_64.h
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-30 07:30:33 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:33 -0500
commit6abcd98ffafbff81f0bfd7ee1d129e634af13245 (patch)
tree8226ad9c29998a5596d351bf8b4eab4dfccaf898 /include/asm-x86/irqflags_64.h
parent416b72182ac3f3f4931ed17d0256b1d805d1b553 (diff)
x86: irqflags consolidation
This patch consolidates the irqflags include files containing common paravirt definitions. The native definition for interrupt handling, halt, and such, are the same for 32 and 64 bit, and they are kept in irqflags.h. the differences are split in the arch-specific files. The syscall function, irq_enable_sysexit, has a very specific i386 naming, and its name is then changed to a more general one. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/irqflags_64.h')
-rw-r--r--include/asm-x86/irqflags_64.h174
1 files changed, 0 insertions, 174 deletions
diff --git a/include/asm-x86/irqflags_64.h b/include/asm-x86/irqflags_64.h
deleted file mode 100644
index 38c07db733cf..000000000000
--- a/include/asm-x86/irqflags_64.h
+++ /dev/null
@@ -1,174 +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__
13/*
14 * Interrupt control:
15 */
16
17static inline unsigned long __raw_local_save_flags(void)
18{
19 unsigned long flags;
20
21 __asm__ __volatile__(
22 "# __raw_save_flags\n\t"
23 "pushfq ; popq %q0"
24 : "=g" (flags)
25 : /* no input */
26 : "memory"
27 );
28
29 return flags;
30}
31
32#define raw_local_save_flags(flags) \
33 do { (flags) = __raw_local_save_flags(); } while (0)
34
35static inline void raw_local_irq_restore(unsigned long flags)
36{
37 __asm__ __volatile__(
38 "pushq %0 ; popfq"
39 : /* no output */
40 :"g" (flags)
41 :"memory", "cc"
42 );
43}
44
45#ifdef CONFIG_X86_VSMP
46
47/*
48 * Interrupt control for the VSMP architecture:
49 */
50
51static inline void raw_local_irq_disable(void)
52{
53 unsigned long flags = __raw_local_save_flags();
54
55 raw_local_irq_restore((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
56}
57
58static inline void raw_local_irq_enable(void)
59{
60 unsigned long flags = __raw_local_save_flags();
61
62 raw_local_irq_restore((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
63}
64
65static inline int raw_irqs_disabled_flags(unsigned long flags)
66{
67 return !(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC);
68}
69
70#else /* CONFIG_X86_VSMP */
71
72static inline void raw_local_irq_disable(void)
73{
74 __asm__ __volatile__("cli" : : : "memory");
75}
76
77static inline void raw_local_irq_enable(void)
78{
79 __asm__ __volatile__("sti" : : : "memory");
80}
81
82static inline int raw_irqs_disabled_flags(unsigned long flags)
83{
84 return !(flags & X86_EFLAGS_IF);
85}
86
87#endif
88
89/*
90 * For spinlocks, etc.:
91 */
92
93static inline unsigned long __raw_local_irq_save(void)
94{
95 unsigned long flags = __raw_local_save_flags();
96
97 raw_local_irq_disable();
98
99 return flags;
100}
101
102#define raw_local_irq_save(flags) \
103 do { (flags) = __raw_local_irq_save(); } while (0)
104
105static inline int raw_irqs_disabled(void)
106{
107 unsigned long flags = __raw_local_save_flags();
108
109 return raw_irqs_disabled_flags(flags);
110}
111
112/*
113 * makes the traced hardirq state match with the machine state
114 *
115 * should be a rarely used function, only in places where its
116 * otherwise impossible to know the irq state, like in traps.
117 */
118static inline void trace_hardirqs_fixup_flags(unsigned long flags)
119{
120 if (raw_irqs_disabled_flags(flags))
121 trace_hardirqs_off();
122 else
123 trace_hardirqs_on();
124}
125
126static inline void trace_hardirqs_fixup(void)
127{
128 unsigned long flags = __raw_local_save_flags();
129
130 trace_hardirqs_fixup_flags(flags);
131}
132/*
133 * Used in the idle loop; sti takes one instruction cycle
134 * to complete:
135 */
136static inline void raw_safe_halt(void)
137{
138 __asm__ __volatile__("sti; hlt" : : : "memory");
139}
140
141/*
142 * Used when interrupts are already enabled or to
143 * shutdown the processor:
144 */
145static inline void halt(void)
146{
147 __asm__ __volatile__("hlt": : :"memory");
148}
149
150#else /* __ASSEMBLY__: */
151# ifdef CONFIG_TRACE_IRQFLAGS
152# define TRACE_IRQS_ON call trace_hardirqs_on_thunk
153# define TRACE_IRQS_OFF call trace_hardirqs_off_thunk
154# else
155# define TRACE_IRQS_ON
156# define TRACE_IRQS_OFF
157# endif
158# ifdef CONFIG_DEBUG_LOCK_ALLOC
159# define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk
160# define LOCKDEP_SYS_EXIT_IRQ \
161 TRACE_IRQS_ON; \
162 sti; \
163 SAVE_REST; \
164 LOCKDEP_SYS_EXIT; \
165 RESTORE_REST; \
166 cli; \
167 TRACE_IRQS_OFF;
168# else
169# define LOCKDEP_SYS_EXIT
170# define LOCKDEP_SYS_EXIT_IRQ
171# endif
172#endif
173
174#endif