1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include <linux/module.h>
23#include <linux/ptrace.h>
24#include <linux/irq.h>
25
26#include <linux/kernel_stat.h>
27#include <linux/signal.h>
28#include <linux/sched.h>
29#include <linux/ioport.h>
30#include <linux/interrupt.h>
31#include <linux/timex.h>
32#include <linux/slab.h>
33#include <linux/random.h>
34#include <linux/init.h>
35#include <linux/seq_file.h>
36#include <linux/errno.h>
37#include <linux/spinlock.h>
38
39#include <asm/io.h>
40
41void ack_bad_irq(unsigned int irq)
42{
43 printk("unexpected IRQ trap at vector %02x\n", irq);
44}
45
46int show_interrupts(struct seq_file *p, void *v)
47{
48 int i = *(loff_t *) v, j;
49 struct irqaction * action;
50 unsigned long flags;
51
52 if (i == 0) {
53 seq_printf(p, " ");
54 for_each_online_cpu(j)
55 seq_printf(p, "CPU%d ",j);
56 seq_putc(p, '\n');
57 }
58
59 if (i < NR_IRQS) {
60 spin_lock_irqsave(&irq_desc[i].lock, flags);
61 action = irq_desc[i].action;
62 if (!action)
63 goto skip;
64 seq_printf(p, "%3d: ",i);
65#ifndef CONFIG_SMP
66 seq_printf(p, "%10u ", kstat_irqs(i));
67#else
68 for_each_online_cpu(j)
69 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
70#endif
71 seq_printf(p, " %14s", irq_desc[i].chip->typename);
72 seq_printf(p, " %s", action->name);
73
74 for (action=action->next; action; action = action->next)
75 seq_printf(p, ", %s", action->name);
76
77 seq_putc(p, '\n');
78skip:
79 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
80 }
81 return 0;
82}
83
84
85
86
87
88
89
90
91
92asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
93{
94 unsigned long sp;
95 struct pt_regs *old_regs = set_irq_regs(regs);
96 irq_enter();
97 sp = rdsp();
98 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
99 printk("do_IRQ: stack overflow: %lX\n", sp);
100 show_stack(NULL, (unsigned long *)sp);
101 }
102 __do_IRQ(irq);
103 irq_exit();
104 set_irq_regs(old_regs);
105}
106
107void weird_irq(void)
108{
109 local_irq_disable();
110 printk("weird irq\n");
111 while(1);
112}
113
114