1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * Common Code for Vectoring MIPS Exceptions |
---|
5 | * |
---|
6 | * The actual decoding of the cause register and vector number assignment |
---|
7 | * is CPU model specific. |
---|
8 | */ |
---|
9 | |
---|
10 | /* |
---|
11 | * COPYRIGHT (c) 1989-2012. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | #include <inttypes.h> |
---|
21 | #include <stdlib.h> |
---|
22 | #include <string.h> |
---|
23 | #include <rtems/mips/iregdef.h> |
---|
24 | #include <rtems/mips/idtcpu.h> |
---|
25 | #include <rtems/bspIo.h> |
---|
26 | #include <bsp/irq-generic.h> |
---|
27 | |
---|
28 | struct regdef |
---|
29 | { |
---|
30 | int offset; |
---|
31 | char *name; |
---|
32 | }; |
---|
33 | |
---|
34 | static const struct regdef dumpregs[]= { |
---|
35 | { R_RA, "R_RA" }, { R_V0, "R_V0" }, { R_V1, "R_V1" }, |
---|
36 | { R_A0, "R_A0" }, { R_A1, "R_A1" }, { R_A2, "R_A2" }, |
---|
37 | { R_A3, "R_A3" }, { R_T0, "R_T0" }, { R_T1, "R_T1" }, |
---|
38 | { R_T2, "R_T2" }, { R_T3, "R_T3" }, { R_T4, "R_T4" }, |
---|
39 | { R_T5, "R_T5" }, { R_T6, "R_T6" }, { R_T7, "R_T7" }, |
---|
40 | { R_T8, "R_T8" }, { R_MDLO, "R_MDLO" }, { R_MDHI, "R_MDHI" }, |
---|
41 | { R_GP, "R_GP" }, { R_FP, "R_FP" }, { R_AT, "R_AT" }, |
---|
42 | { R_EPC,"R_EPC"}, { -1, NULL } |
---|
43 | }; |
---|
44 | |
---|
45 | void _CPU_Exception_frame_print( const CPU_Exception_frame *frame ) |
---|
46 | { |
---|
47 | uint32_t *frame_u32; |
---|
48 | int i, j; |
---|
49 | |
---|
50 | frame_u32 = (uint32_t *)frame; |
---|
51 | for(i=0; dumpregs[i].offset > -1; i++) |
---|
52 | { |
---|
53 | printk(" %s", dumpregs[i].name); |
---|
54 | for(j=0; j< 7-strlen(dumpregs[i].name); j++) printk(" "); |
---|
55 | #if (__mips == 1 ) || (__mips == 32) |
---|
56 | printk(" %08" PRIu32 "%c", |
---|
57 | frame_u32[dumpregs[i].offset], (i%3) ? '\t' : '\n' ); |
---|
58 | #elif __mips == 3 |
---|
59 | printk(" %08" PRIu32 "", frame_u32[2 * dumpregs[i].offset + 1] ); |
---|
60 | printk("%08" PRIu32 "%c", |
---|
61 | frame_u32[2 * dumpregs[i].offset], (i%2) ? '\t' : '\n' ); |
---|
62 | #endif |
---|
63 | } |
---|
64 | printk( "\n" ); |
---|
65 | } |
---|
66 | |
---|
67 | /* |
---|
68 | * There are constants defined for these but they should basically |
---|
69 | * all be close to the same set. |
---|
70 | */ |
---|
71 | |
---|
72 | void mips_vector_exceptions( CPU_Interrupt_frame *frame ) |
---|
73 | { |
---|
74 | uint32_t cause; |
---|
75 | uint32_t exc; |
---|
76 | |
---|
77 | mips_get_cause( cause ); |
---|
78 | exc = (cause >> 2) & 0x1f; |
---|
79 | |
---|
80 | bsp_interrupt_handler_dispatch( exc ); |
---|
81 | } |
---|