source: rtems/c/src/lib/libbsp/mips/shared/irq/vectorexceptions.c @ 63defa58

Last change on this file since 63defa58 was 63defa58, checked in by Jennifer Averett <jennifer.averett@…>, on 04/04/12 at 13:39:46

PR 1993 - Convert MIPS to PIC IRQ model

  • Property mode set to 100644
File size: 3.0 KB
Line 
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.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#include <rtems.h>
22#include <stdlib.h>
23#include <string.h>
24#include <rtems/mips/iregdef.h>
25#include <rtems/mips/idtcpu.h>
26#include <rtems/bspIo.h>
27#include <bsp/irq-generic.h>
28
29void mips_vector_exceptions( CPU_Interrupt_frame *frame );
30
31static const char *cause_strings[32] =
32{
33  /*  0 */ "Int",
34  /*  1 */ "TLB Mods",
35  /*  2 */ "TLB Load",
36  /*  3 */ "TLB Store",
37  /*  4 */ "Address Load",
38  /*  5 */ "Address Store",
39  /*  6 */ "Instruction Bus Error",
40  /*  7 */ "Data Bus Error",
41  /*  8 */ "Syscall",
42  /*  9 */ "Breakpoint",
43  /* 10 */ "Reserved Instruction",
44  /* 11 */ "Coprocessor Unuseable",
45  /* 12 */ "Overflow",
46  /* 13 */ "Trap",
47  /* 14 */ "Instruction Virtual Coherency Error",
48  /* 15 */ "FP Exception",
49  /* 16 */ "Reserved 16",
50  /* 17 */ "Reserved 17",
51  /* 18 */ "Reserved 18",
52  /* 19 */ "Reserved 19",
53  /* 20 */ "Reserved 20",
54  /* 21 */ "Reserved 21",
55  /* 22 */ "Reserved 22",
56  /* 23 */ "Watch",
57  /* 24 */ "Reserved 24",
58  /* 25 */ "Reserved 25",
59  /* 26 */ "Reserved 26",
60  /* 27 */ "Reserved 27",
61  /* 28 */ "Reserved 28",
62  /* 29 */ "Reserved 29",
63  /* 30 */ "Reserved 30",
64  /* 31 */ "Data Virtual Coherency Error"
65};
66
67struct regdef
68{
69  int  offset;
70  char *name;
71};
72
73static const struct regdef dumpregs[]= {
74  { R_RA, "R_RA" }, { R_V0, "R_V0" },     { R_V1, "R_V1" },
75  { R_A0, "R_A0" }, { R_A1, "R_A1" },     { R_A2, "R_A2" },
76  { R_A3, "R_A3" }, { R_T0, "R_T0" },     { R_T1, "R_T1" },
77  { R_T2, "R_T2" }, { R_T3, "R_T3" },     { R_T4, "R_T4" },
78  { R_T5, "R_T5" }, { R_T6, "R_T6" },     { R_T7, "R_T7" },
79  { R_T8, "R_T8" }, { R_MDLO, "R_MDLO" }, { R_MDHI, "R_MDHI" },
80  { R_GP, "R_GP" }, { R_FP, "R_FP" },     { R_AT, "R_AT" },
81  { R_EPC,"R_EPC"}, { -1, NULL }
82};
83
84static void mips_dump_exception_frame( CPU_Interrupt_frame *frame )
85{
86  uint32_t *frame_u32;
87  int   i, j;
88
89  frame_u32 = (uint32_t *)frame;
90  for(i=0; dumpregs[i].offset > -1; i++)
91  {
92     printk("   %s", dumpregs[i].name);
93     for(j=0; j< 7-strlen(dumpregs[i].name); j++) printk(" ");
94#if (__mips == 1 ) || (__mips == 32)
95     printk("  %08X%c", frame_u32[dumpregs[i].offset], (i%3) ? '\t' : '\n' );
96#elif __mips == 3
97     printk("  %08X", frame_u32[2 * dumpregs[i].offset + 1] );
98     printk("%08X%c", frame_u32[2 * dumpregs[i].offset], (i%2) ? '\t' : '\n' );
99#endif
100  }
101  printk( "\n" );
102}
103
104/*
105 *  There are constants defined for these but they should basically
106 *  all be close to the same set.
107 */
108
109void mips_vector_exceptions( CPU_Interrupt_frame *frame )
110{
111  uint32_t   cause;
112  uint32_t   exc;
113
114  mips_get_cause( cause );
115  exc = (cause >> 2) & 0x1f;
116
117  bsp_interrupt_handler_dispatch( exc );
118}
Note: See TracBrowser for help on using the repository browser.