fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-i386 / mach-xen / asm / irqflags.h
1 /*
2  * include/asm-i386/irqflags.h
3  *
4  * IRQ flags handling
5  *
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.
9  */
10 #ifndef _ASM_IRQFLAGS_H
11 #define _ASM_IRQFLAGS_H
12
13 #ifdef CONFIG_PARAVIRT
14 #include <asm/paravirt.h>
15 #else
16 #ifndef __ASSEMBLY__
17
18 unsigned long __raw_local_save_flags(void);
19
20 void raw_local_irq_restore(unsigned long flags);
21 void raw_local_irq_disable(void);
22 void raw_local_irq_enable(void);
23
24 /*
25  * Used in the idle loop; sti takes one instruction cycle
26  * to complete:
27  */
28 void raw_safe_halt(void);
29
30 /*
31  * Used when interrupts are already enabled or to
32  * shutdown the processor:
33  */
34 void halt(void);
35
36 /*
37  * For spinlocks, etc:
38  */
39 unsigned long __raw_local_irq_save(void);
40
41 #else
42 #define DISABLE_INTERRUPTS(clobbers)    GET_VCPU_INFO                           ; \
43                                         __DISABLE_INTERRUPTS
44 #define ENABLE_INTERRUPTS(clobbers)     GET_VCPU_INFO                           ; \
45                                         __ENABLE_INTERRUPTS
46 #define ENABLE_INTERRUPTS_SYSEXIT       NET_DONE_YET
47 #define INTERRUPT_RETURN                iret
48 #define GET_CR0_INTO_EAX                NOT_DONE_YET
49 #endif /* __ASSEMBLY__ */
50 #endif /* CONFIG_PARAVIRT */
51
52 #ifndef __ASSEMBLY__
53 #define raw_local_save_flags(flags) \
54                 do { (flags) = __raw_local_save_flags(); } while (0)
55
56 #define raw_local_irq_save(flags) \
57                 do { (flags) = __raw_local_irq_save(); } while (0)
58
59 static inline int raw_irqs_disabled_flags(unsigned long flags)
60 {
61         return flags != 0;
62 }
63
64 int raw_irqs_disabled(void);
65 #endif /* __ASSEMBLY__ */
66
67 /*
68  * Do the CPU's IRQ-state tracing from assembly code. We call a
69  * C function, so save all the C-clobbered registers:
70  */
71 #ifdef CONFIG_TRACE_IRQFLAGS
72
73 # define TRACE_IRQS_ON                          \
74         pushl %eax;                             \
75         pushl %ecx;                             \
76         pushl %edx;                             \
77         call trace_hardirqs_on;                 \
78         popl %edx;                              \
79         popl %ecx;                              \
80         popl %eax;
81
82 # define TRACE_IRQS_OFF                         \
83         pushl %eax;                             \
84         pushl %ecx;                             \
85         pushl %edx;                             \
86         call trace_hardirqs_off;                \
87         popl %edx;                              \
88         popl %ecx;                              \
89         popl %eax;
90
91 #else
92 # define TRACE_IRQS_ON
93 # define TRACE_IRQS_OFF
94 #endif
95
96 #endif