source: rtems/c/src/lib/libbsp/powerpc/eth_comm/vectors/vectors_init.c @ 600e77a

4.104.114.84.95
Last change on this file since 600e77a was 600e77a, checked in by Joel Sherrill <joel.sherrill@…>, on 04/18/02 at 20:54:49

2002-04-18 Ralf Corsepius <corsepiu@…>

  • irq/irq.c: Reflect changed to <rtems/score/cpu.h>.
  • irq/irq_asm.S: Ditto.
  • vectors/vectors.S: Ditto.
  • vectors/vectors_init.c: Include <rtems/bspIo.h>.
  • 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 *  CopyRight (C) 1999 valette@crf.canon.fr
8 *
9 *  The license and distribution terms for this file may be
10 *  found in found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <bsp/vectors.h>
17#include <libcpu/raw_exception.h>
18#include <bsp.h>
19#include <rtems/bspIo.h>
20
21static rtems_raw_except_global_settings exception_config;
22static rtems_raw_except_connect_data    exception_table[LAST_VALID_EXC + 1];
23
24exception_handler_t globalExceptHdl;
25
26void C_exception_handler(BSP_Exception_frame* excPtr)
27{
28  int recoverable = 0;
29 
30  printk("exception handler called for exception %d\n", excPtr->_EXC_number);
31  printk("\t Next PC or Address of fault = %x\n", excPtr->EXC_SRR0);
32  printk("\t Saved MSR = %x\n", excPtr->EXC_SRR1);
33  printk("\t R0 = %x\n", excPtr->GPR0);
34  printk("\t R1 = %x\n", excPtr->GPR1);
35  printk("\t R2 = %x\n", excPtr->GPR2);
36  printk("\t R3 = %x\n", excPtr->GPR3);
37  printk("\t R4 = %x\n", excPtr->GPR4);
38  printk("\t R5 = %x\n", excPtr->GPR5);
39  printk("\t R6 = %x\n", excPtr->GPR6);
40  printk("\t R7 = %x\n", excPtr->GPR7);
41  printk("\t R8 = %x\n", excPtr->GPR8);
42  printk("\t R9 = %x\n", excPtr->GPR9);
43  printk("\t R10 = %x\n", excPtr->GPR10);
44  printk("\t R11 = %x\n", excPtr->GPR11);
45  printk("\t R12 = %x\n", excPtr->GPR12);
46  printk("\t R13 = %x\n", excPtr->GPR13);
47  printk("\t R14 = %x\n", excPtr->GPR14);
48  printk("\t R15 = %x\n", excPtr->GPR15);
49  printk("\t R16 = %x\n", excPtr->GPR16);
50  printk("\t R17 = %x\n", excPtr->GPR17);
51  printk("\t R18 = %x\n", excPtr->GPR18);
52  printk("\t R19 = %x\n", excPtr->GPR19);
53  printk("\t R20 = %x\n", excPtr->GPR20);
54  printk("\t R21 = %x\n", excPtr->GPR21);
55  printk("\t R22 = %x\n", excPtr->GPR22);
56  printk("\t R23 = %x\n", excPtr->GPR23);
57  printk("\t R24 = %x\n", excPtr->GPR24);
58  printk("\t R25 = %x\n", excPtr->GPR25);
59  printk("\t R26 = %x\n", excPtr->GPR26);
60  printk("\t R27 = %x\n", excPtr->GPR27);
61  printk("\t R28 = %x\n", excPtr->GPR28);
62  printk("\t R29 = %x\n", excPtr->GPR29);
63  printk("\t R30 = %x\n", excPtr->GPR30);
64  printk("\t R31 = %x\n", excPtr->GPR31);
65  printk("\t CR = %x\n", excPtr->EXC_CR);
66  printk("\t CTR = %x\n", excPtr->EXC_CTR);
67  printk("\t XER = %x\n", excPtr->EXC_XER);
68  printk("\t LR = %x\n", excPtr->EXC_LR);
69  printk("\t MSR = %x\n", excPtr->EXC_MSR);
70  if (excPtr->_EXC_number == ASM_DEC_VECTOR)
71       recoverable = 1;
72  if (excPtr->_EXC_number == ASM_SYS_VECTOR)
73#ifdef TEST_RAW_EXCEPTION_CODE     
74    recoverable = 1;
75#else
76    recoverable = 0;
77#endif
78    if (!recoverable) {
79      printk("unrecoverable exception!!! Push reset button\n");
80      while(1);
81    }
82}
83
84void nop_except_enable(const rtems_raw_except_connect_data* ptr)
85{
86}
87int except_always_enabled(const rtems_raw_except_connect_data* ptr)
88{
89  return 1;
90}
91
92void initialize_exceptions()
93{
94  int i;
95
96  /*
97   * Initialize pointer used by low level execption handling
98   */
99  globalExceptHdl                               = C_exception_handler;
100  /*
101   * Put  default_exception_vector_code_prolog at relevant exception
102   * code entry addresses
103   */
104  exception_config.exceptSize                   = LAST_VALID_EXC + 1;
105  exception_config.rawExceptHdlTbl              = &exception_table[0];
106  exception_config.defaultRawEntry.exceptIndex  = 0;
107  exception_config.defaultRawEntry.hdl.vector   = 0;
108  exception_config.defaultRawEntry.hdl.raw_hdl  = default_exception_vector_code_prolog;
109  /*
110   * Note that next line the '&' before default_exception_vector_code_prolog_size
111   * is not a bug as it is defined a .set directly in asm...
112   */
113  exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) &default_exception_vector_code_prolog_size;
114  for (i=0; i <= exception_config.exceptSize; i++) {
115    printk("installing exception number %d\n", i);
116    if (!mpc8xx_vector_is_valid (i)) {
117      continue;
118    }
119    exception_table[i].exceptIndex      = i;
120    exception_table[i].hdl              = exception_config.defaultRawEntry.hdl;
121    exception_table[i].hdl.vector       = i;
122    exception_table[i].on               = nop_except_enable;
123    exception_table[i].off              = nop_except_enable;
124    exception_table[i].isOn             = except_always_enabled;
125  }
126  if (!mpc8xx_init_exceptions(&exception_config)) {
127    /*
128     * At this stage we may not call BSP_Panic because it uses exceptions!!!
129     */
130    printk("Exception handling initialization failed\n");
131    printk("System locked\n"); while(1);
132  }
133  else {
134    printk("Exception handling initialization done\n");
135  }
136}
Note: See TracBrowser for help on using the repository browser.