debuggers.hg

view xen/include/asm-i386/hardirq.h @ 656:c7557b3832b9

bitkeeper revision 1.339.1.6 (3f12cffdzSdqoflJR3gfS-S45xcteA)

nmi.c:
new file
Many files:
NMI watchdog support in Xen.
author kaf24@scramble.cl.cam.ac.uk
date Mon Jul 14 15:45:01 2003 +0000 (2003-07-14)
parents 6e398cd3bf49
children c085fac641e2
line source
1 #ifndef __ASM_HARDIRQ_H
2 #define __ASM_HARDIRQ_H
4 #include <xeno/config.h>
5 #include <xeno/irq.h>
7 /* assembly code in softirq.h is sensitive to the offsets of these fields */
8 typedef struct {
9 unsigned int __softirq_pending;
10 unsigned int __local_irq_count;
11 unsigned int __local_bh_count;
12 unsigned int __syscall_count;
13 unsigned int __nmi_count;
14 unsigned long idle_timestamp;
15 } ____cacheline_aligned irq_cpustat_t;
17 #include <xeno/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
19 /*
20 * Are we in an interrupt context? Either doing bottom half
21 * or hardware interrupt processing?
22 */
23 #define in_interrupt() ({ int __cpu = smp_processor_id(); \
24 (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); })
26 #define in_irq() (local_irq_count(smp_processor_id()) != 0)
28 #ifndef CONFIG_SMP
30 #define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
31 #define hardirq_endlock(cpu) do { } while (0)
33 #define irq_enter(cpu, irq) (local_irq_count(cpu)++)
34 #define irq_exit(cpu, irq) (local_irq_count(cpu)--)
36 #define synchronize_irq() barrier()
38 #else
40 #include <asm/atomic.h>
41 #include <asm/smp.h>
43 extern unsigned char global_irq_holder;
44 extern unsigned volatile long global_irq_lock; /* long for set_bit -RR */
46 static inline int irqs_running (void)
47 {
48 int i;
50 for (i = 0; i < smp_num_cpus; i++)
51 if (local_irq_count(i))
52 return 1;
53 return 0;
54 }
56 static inline void release_irqlock(int cpu)
57 {
58 /* if we didn't own the irq lock, just ignore.. */
59 if (global_irq_holder == (unsigned char) cpu) {
60 global_irq_holder = 0xff;
61 clear_bit(0,&global_irq_lock);
62 }
63 }
65 static inline void irq_enter(int cpu, int irq)
66 {
67 ++local_irq_count(cpu);
69 while (test_bit(0,&global_irq_lock)) {
70 cpu_relax();
71 }
72 }
74 static inline void irq_exit(int cpu, int irq)
75 {
76 --local_irq_count(cpu);
77 }
79 static inline int hardirq_trylock(int cpu)
80 {
81 return !local_irq_count(cpu) && !test_bit(0,&global_irq_lock);
82 }
84 #define hardirq_endlock(cpu) do { } while (0)
86 extern void synchronize_irq(void);
88 #endif /* CONFIG_SMP */
90 #endif /* __ASM_HARDIRQ_H */