source: rtems/c/src/lib/libcpu/mips/shared/interrupts/vectorexceptions.c @ 51dc8e92

4.104.114.84.95
Last change on this file since 51dc8e92 was 51dc8e92, checked in by Joel Sherrill <joel.sherrill@…>, on 01/04/02 at 18:16:36

2002-01-03 Ralf Corsepius <corsepiu@…>

  • mongoosev/vectorisrs/vectorisrs.c: Include rtems/bspIo.h instead of bspIo.h.
  • r46xx/vectorisrs/vectorisrs.c: Include rtems/bspIo.h instead of bspIo.h.
  • shared/interrupts/vectorexceptions.c: Include rtems/bspIo.h instead of bspIo.h.
  • tx39/vectorisrs/vectorisrs.c: Include rtems/bspIo.h instead of bspIo.h.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*
2 *  Common Code for Vectoring MIPS Exceptions
3 *
4 *  The actual decoding of the cause register and vector number assignment
5 *  is CPU model specific.
6 *
7 *  $Id$
8 */
9
10#include <rtems.h>
11#include <stdlib.h>
12#include "iregdef.h"
13#include "idtcpu.h"
14#include <rtems/bspIo.h>
15
16char *cause_strings[32] =
17{
18  /*  0 */ "Int",
19  /*  1 */ "TLB Mods",
20  /*  2 */ "TLB Load",
21  /*  3 */ "TLB Store",
22  /*  4 */ "Address Load",
23  /*  5 */ "Address Store",
24  /*  6 */ "Instruction Bus Error",
25  /*  7 */ "Data Bus Error",
26  /*  9 */ "Syscall",
27  /* 10 */ "Breakpoint",
28  /* 11 */ "Reserved Instruction",
29  /* 12 */ "Coprocessor Unuseable",
30  /* 13 */ "Overflow",
31  /* 14 */ "Trap",
32  /* 15 */ "Instruction Virtual Coherency Error",
33  /* 16 */ "FP Exception",
34  /* 17 */ "Reserved 17",
35  /* 18 */ "Reserved 17",
36  /* 19 */ "Reserved 17",
37  /* 20 */ "Reserved 20",
38  /* 21 */ "Reserved 21",
39  /* 22 */ "Reserved 22",
40  /* 23 */ "Watch",
41  /* 24 */ "Reserved 24",
42  /* 25 */ "Reserved 25",
43  /* 26 */ "Reserved 26",
44  /* 27 */ "Reserved 27",
45  /* 28 */ "Reserved 28",
46  /* 29 */ "Reserved 29",
47  /* 30 */ "Reserved 30",
48  /* 31 */ "Data Virtual Coherency Error"
49};
50
51struct regdef
52{
53  int  offset;
54  char *name;
55};
56
57struct regdef dumpregs[]= {
58  { R_RA, "R_RA" }, { R_V0, "R_V0" },     { R_V1, "R_V1" },
59  { R_A0, "R_A0" }, { R_A1, "R_A1" },     { R_A2, "R_A2" },
60  { R_A3, "R_A3" }, { R_T0, "R_T0" },     { R_T1, "R_T1" },
61  { R_T2, "R_T2" }, { R_T3, "R_T3" },     { R_T4, "R_T4" },
62  { R_T5, "R_T5" }, { R_T6, "R_T6" },     { R_T7, "R_T7" },
63  { R_T8, "R_T8" }, { R_MDLO, "R_MDLO" }, { R_MDHI, "R_MDHI" },
64  { R_GP, "R_GP" }, { R_FP, "R_FP" },     { R_AT, "R_AT" },
65  { R_EPC,"R_EPC"}, { -1, NULL }
66};
67
68
69void mips_default_exception_code_handler( int exc, CPU_Interrupt_frame *frame )
70{
71  unsigned int sr;
72  unsigned int cause;
73  int   i, j;
74
75  mips_get_sr( sr );
76  mips_get_cause( cause );
77
78  printk( "Unhandled exception %d\n", exc );
79  printk( "sr: 0x%08x  cause: 0x%08x --> %s\n", sr, cause,
80     cause_strings[(cause >> 2) &0x1f] );
81
82  for(i=0; dumpregs[i].offset > -1; i++)
83  {
84     printk("   %s", dumpregs[i].name);
85     for(j=0; j< 7-strlen(dumpregs[i].name); j++) printk(" ");
86     printk("  %08X\n", frame->regs[dumpregs[i].offset] );
87  }
88
89  rtems_fatal_error_occurred(1);
90}
91
92#define CALL_EXC(_vector,_frame) \
93   do { \
94        if ( _ISR_Vector_table[_vector] ) \
95             (_ISR_Vector_table[_vector])(_vector,_frame); \
96          else \
97             mips_default_exception_code_handler( _vector, _frame ); \
98   } while(0)
99
100/*
101 *  There are constants defined for these but they should basically
102 *  all be close to the same set.
103 */
104
105void mips_vector_exceptions( CPU_Interrupt_frame *frame )
106{
107  unsigned32 cause;
108  unsigned32 exc;
109
110  mips_get_cause( cause );
111  exc = (cause >> 2) & 0x1f;
112
113  CALL_EXC( exc, frame );
114}
115
Note: See TracBrowser for help on using the repository browser.