1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#include <common.h>
28#include <watchdog.h>
29#include <command.h>
30#include <asm/processor.h>
31
32
33extern void _exc_handler(void);
34extern void _int_handler(void);
35
36static void show_frame(struct pt_regs *fp)
37{
38 printf ("Vector Number: %d Format: %02x Fault Status: %01x\n\n", (fp->vector & 0x3fc) >> 2,
39 fp->format, (fp->vector & 0x3) | ((fp->vector & 0xc00) >> 8));
40 printf ("PC: %08lx SR: %08lx SP: %08lx\n", fp->pc, (long) fp->sr, (long) fp);
41 printf ("D0: %08lx D1: %08lx D2: %08lx D3: %08lx\n",
42 fp->d0, fp->d1, fp->d2, fp->d3);
43 printf ("D4: %08lx D5: %08lx D6: %08lx D7: %08lx\n",
44 fp->d4, fp->d5, fp->d6, fp->d7);
45 printf ("A0: %08lx A1: %08lx A2: %08lx A3: %08lx\n",
46 fp->a0, fp->a1, fp->a2, fp->a3);
47 printf ("A4: %08lx A5: %08lx A6: %08lx\n",
48 fp->a4, fp->a5, fp->a6);
49}
50
51void exc_handler(struct pt_regs *fp) {
52 printf("\n\n*** Unexpected exception ***\n");
53 show_frame (fp);
54 printf("\n*** Please Reset Board! ***\n");
55 for(;;);
56}
57
58void trap_init(ulong value) {
59 unsigned long *vec = (ulong *)value;
60 int i;
61
62 for(i = 2; i < 25; i++) {
63 vec[i] = (unsigned long)_exc_handler;
64 }
65 for(i = 25; i < 32; i++) {
66 vec[i] = (unsigned long)_int_handler;
67 }
68 for(i = 32; i < 64; i++) {
69 vec[i] = (unsigned long)_exc_handler;
70 }
71 for(i = 64; i < 256; i++) {
72 vec[i] = (unsigned long)_int_handler;
73 }
74
75 setvbr(value);
76}
77