source: rtems/c/src/lib/libbsp/powerpc/mbx8xx/vectors/vectors_init.c @ 848e900

4.104.114.84.95
Last change on this file since 848e900 was 848e900, checked in by Joel Sherrill <joel.sherrill@…>, on 09/12/05 at 13:32:58

2005-09-12 Thomas Doerfler <Thomas.Doerfler@…>

PR 822/bsps

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