This source file includes following definitions.
- die_if_kernel
- do_entArith
- do_entIF
- do_entUna
- do_entSys
- trap_init
1
2
3
4
5
6
7
8
9
10
11 #include <linux/sched.h>
12
13 void die_if_kernel(char * str, struct pt_regs * regs, long err)
14 {
15 unsigned long i;
16
17 printk("%s %ld\n", str, err);
18 printk("pc = %016lx ps = %04lx\n", regs->pc, regs->ps);
19 printk("rp = %016lx sp = %p\n", regs->r26, regs+1);
20 for (i = 0 ; i < 5000000000 ; i++)
21 ;
22 halt();
23 }
24
25 asmlinkage void do_entArith(unsigned long summary, unsigned long write_mask,
26 unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5,
27 struct pt_regs regs)
28 {
29 printk("Arithmetic trap: %02lx %016lx\n", summary, write_mask);
30 die_if_kernel("Arithmetic fault", ®s, 0);
31 }
32
33 asmlinkage void do_entIF(unsigned long type, unsigned long a1, unsigned long a2,
34 unsigned long a3, unsigned long a4, unsigned long a5,
35 struct pt_regs regs)
36 {
37 die_if_kernel("Instruction fault", ®s, type);
38 }
39
40 asmlinkage void do_entUna(unsigned long va, unsigned long opcode, unsigned long reg,
41 unsigned long a3, unsigned long a4, unsigned long a5,
42 struct pt_regs regs)
43 {
44 printk("Unaligned trap: %016lx %ld %ld\n", va, opcode, reg);
45 die_if_kernel("Unaligned", ®s, 0);
46 }
47
48
49
50
51
52
53
54
55
56
57
58
59 asmlinkage void do_entSys(unsigned long a0, unsigned long a1, unsigned long a2,
60 unsigned long a3, unsigned long a4, unsigned long a5, struct pt_regs regs)
61 {
62 printk("System call %ld(%ld,%ld)\n", regs.r0, a0, a1);
63 die_if_kernel("Syscall", ®s, 0);
64 }
65
66 extern asmlinkage void entMM(void);
67 extern asmlinkage void entIF(void);
68 extern asmlinkage void entArith(void);
69 extern asmlinkage void entUna(void);
70 extern asmlinkage void entSys(void);
71
72 void trap_init(void)
73 {
74 unsigned long gptr;
75
76
77
78
79 __asm__("br %0,___tmp\n"
80 "___tmp:\tldgp %0,0(%0)"
81 : "=r" (gptr));
82 wrkgp(gptr);
83
84 wrent(entArith, 1);
85 wrent(entMM, 2);
86 wrent(entIF, 3);
87 wrent(entUna, 4);
88 wrent(entSys, 5);
89 }