source: rtems/c/src/lib/libcpu/powerpc/mpc5xx/vectors/vectors_init.c @ 73b5bd5d

4.104.114.84.95
Last change on this file since 73b5bd5d was 8430205, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 12, 2004 at 10:04:28 PM

2004-04-12 David Querbach <querbach@…>

  • README, configure.ac, mpc5xx/Makefile.am, mpc5xx/exceptions/raw_exception.c, mpc5xx/exceptions/raw_exception.h, mpc5xx/timer/timer.c, shared/include/cpuIdent.h: addition of a significant amount of MPC5xx support as part of the addition of the SS555 BSP.
  • mpc5xx/README, mpc5xx/clock/clock.c, mpc5xx/console-generic/console-generic.c, mpc5xx/include/console.h, mpc5xx/include/mpc5xx.h, mpc5xx/irq/irq.c, mpc5xx/irq/irq.h, mpc5xx/irq/irq_asm.S, mpc5xx/irq/irq_init.c, mpc5xx/vectors/vectors.S, mpc5xx/vectors/vectors.h, mpc5xx/vectors/vectors_init.c: New files.
  • mpc5xx/exceptions/asm_utils.S: Removed.
  • Property mode set to 100644
File size: 4.5 KB
Line 
1/*
2 * vectors_init.c Exception hanlding initialisation (and generic handler).
3 *
4 *  This include file describe the data structure and the functions implemented
5 *  by rtems to handle exceptions.
6 *
7 *
8 *  MPC5xx port sponsored by Defence Research and Development Canada - Suffield
9 *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
10 *
11 *  Derived from libbsp/powerpc/mbx8xx/vectors/vectors_init.c:
12 *
13 *  CopyRight (C) 1999 valette@crf.canon.fr
14 *
15 *  The license and distribution terms for this file may be
16 *  found in found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 *
19 *  $Id$
20 */
21#include <rtems/bspIo.h>
22#include <libcpu/vectors.h>
23#include <libcpu/raw_exception.h>
24
25extern rtems_exception_handler_t default_exception_handler;
26
27static rtems_raw_except_global_settings exception_config;
28static rtems_raw_except_connect_data    exception_table[NUM_EXCEPTIONS];
29rtems_exception_handler_t* exception_handler_table[NUM_EXCEPTIONS];
30
31
32void C_default_exception_handler(CPU_Exception_frame* excPtr)
33{
34  int recoverable = 0;
35 
36  printk("exception handler called for exception %d\n", excPtr->_EXC_number);
37  printk("\t Next PC or Address of fault = %x\n", excPtr->EXC_SRR0);
38  printk("\t Saved MSR = %x\n", excPtr->EXC_SRR1);
39  printk("\t R0 = %x\n", excPtr->GPR0);
40  printk("\t R1 = %x\n", excPtr->GPR1);
41  printk("\t R2 = %x\n", excPtr->GPR2);
42  printk("\t R3 = %x\n", excPtr->GPR3);
43  printk("\t R4 = %x\n", excPtr->GPR4);
44  printk("\t R5 = %x\n", excPtr->GPR5);
45  printk("\t R6 = %x\n", excPtr->GPR6);
46  printk("\t R7 = %x\n", excPtr->GPR7);
47  printk("\t R8 = %x\n", excPtr->GPR8);
48  printk("\t R9 = %x\n", excPtr->GPR9);
49  printk("\t R10 = %x\n", excPtr->GPR10);
50  printk("\t R11 = %x\n", excPtr->GPR11);
51  printk("\t R12 = %x\n", excPtr->GPR12);
52  printk("\t R13 = %x\n", excPtr->GPR13);
53  printk("\t R14 = %x\n", excPtr->GPR14);
54  printk("\t R15 = %x\n", excPtr->GPR15);
55  printk("\t R16 = %x\n", excPtr->GPR16);
56  printk("\t R17 = %x\n", excPtr->GPR17);
57  printk("\t R18 = %x\n", excPtr->GPR18);
58  printk("\t R19 = %x\n", excPtr->GPR19);
59  printk("\t R20 = %x\n", excPtr->GPR20);
60  printk("\t R21 = %x\n", excPtr->GPR21);
61  printk("\t R22 = %x\n", excPtr->GPR22);
62  printk("\t R23 = %x\n", excPtr->GPR23);
63  printk("\t R24 = %x\n", excPtr->GPR24);
64  printk("\t R25 = %x\n", excPtr->GPR25);
65  printk("\t R26 = %x\n", excPtr->GPR26);
66  printk("\t R27 = %x\n", excPtr->GPR27);
67  printk("\t R28 = %x\n", excPtr->GPR28);
68  printk("\t R29 = %x\n", excPtr->GPR29);
69  printk("\t R30 = %x\n", excPtr->GPR30);
70  printk("\t R31 = %x\n", excPtr->GPR31);
71  printk("\t CR = %x\n", excPtr->EXC_CR);
72  printk("\t CTR = %x\n", excPtr->EXC_CTR);
73  printk("\t XER = %x\n", excPtr->EXC_XER);
74  printk("\t LR = %x\n", excPtr->EXC_LR);
75  printk("\t MSR = %x\n", excPtr->EXC_MSR);
76  if (excPtr->_EXC_number == ASM_DEC_VECTOR)
77       recoverable = 1;
78  if (excPtr->_EXC_number == ASM_SYS_VECTOR)
79#ifdef TEST_RAW_EXCEPTION_CODE     
80    recoverable = 1;
81#else
82    recoverable = 0;
83#endif
84    if (!recoverable) {
85      printk("unrecoverable exception!!! Push reset button\n");
86      while(1);
87    }
88}
89
90void nop_except_enable(const rtems_raw_except_connect_data* ptr)
91{
92}
93
94int except_always_enabled(const rtems_raw_except_connect_data* ptr)
95{
96  return 1;
97}
98
99void initialize_exceptions()
100{
101  int i;
102
103  /*
104   * Initialize all entries of the exception table with a description of the
105   * default exception handler.
106   */
107  exception_config.exceptSize                   = NUM_EXCEPTIONS;
108  exception_config.rawExceptHdlTbl              = &exception_table[0];
109  exception_config.defaultRawEntry.exceptIndex  = 0;
110  exception_config.defaultRawEntry.hdl.vector   = 0;
111  exception_config.defaultRawEntry.hdl.raw_hdl  = default_exception_handler;
112
113  for (i = 0; i < exception_config.exceptSize; i++) {
114    printk("installing exception number %d\n", i);
115    exception_table[i].exceptIndex      = i;
116    exception_table[i].hdl              = exception_config.defaultRawEntry.hdl;
117    exception_table[i].hdl.vector       = i;
118    exception_table[i].on               = nop_except_enable;
119    exception_table[i].off              = nop_except_enable;
120    exception_table[i].isOn             = except_always_enabled;
121  }
122
123  /*
124   * Now pass the initialized exception table to the exceptions module which
125   * will install the handler pointers in the exception handler table.
126   */
127  if (!mpc5xx_init_exceptions(&exception_config)) {
128    /*
129     * At this stage we may not call CPU_Panic because it uses exceptions!!!
130     */
131    printk("Exception handling initialization failed\n");
132    printk("System locked\n"); while(1);
133  }
134  else {
135    printk("Exception handling initialization done\n");
136  }
137}
Note: See TracBrowser for help on using the repository browser.