OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [powerpc/] [shared/] [vectors/] [vectors_init.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: vectors_init.c,v 1.2 2001-09-27 12:01:09 chris Exp $
14
 */
15
#include <bsp/vectors.h>
16
#include <libcpu/raw_exception.h>
17
#include <bsp.h>
18
 
19
static rtems_raw_except_global_settings exception_config;
20
static rtems_raw_except_connect_data    exception_table[LAST_VALID_EXC + 1];
21
 
22
exception_handler_t globalExceptHdl;
23
 
24
void C_exception_handler(BSP_Exception_frame* excPtr)
25
{
26
  int recoverable = 0;
27
 
28
  printk("exception handler called for exception %d\n", excPtr->_EXC_number);
29
  printk("\t Next PC or Address of fault = %x\n", excPtr->EXC_SRR0);
30
  printk("\t Saved MSR = %x\n", excPtr->EXC_SRR1);
31
  printk("\t R0 = %x\n", excPtr->GPR0);
32
  printk("\t R1 = %x\n", excPtr->GPR1);
33
  printk("\t R2 = %x\n", excPtr->GPR2);
34
  printk("\t R3 = %x\n", excPtr->GPR3);
35
  printk("\t R4 = %x\n", excPtr->GPR4);
36
  printk("\t R5 = %x\n", excPtr->GPR5);
37
  printk("\t R6 = %x\n", excPtr->GPR6);
38
  printk("\t R7 = %x\n", excPtr->GPR7);
39
  printk("\t R8 = %x\n", excPtr->GPR8);
40
  printk("\t R9 = %x\n", excPtr->GPR9);
41
  printk("\t R10 = %x\n", excPtr->GPR10);
42
  printk("\t R11 = %x\n", excPtr->GPR11);
43
  printk("\t R12 = %x\n", excPtr->GPR12);
44
  printk("\t R13 = %x\n", excPtr->GPR13);
45
  printk("\t R14 = %x\n", excPtr->GPR14);
46
  printk("\t R15 = %x\n", excPtr->GPR15);
47
  printk("\t R16 = %x\n", excPtr->GPR16);
48
  printk("\t R17 = %x\n", excPtr->GPR17);
49
  printk("\t R18 = %x\n", excPtr->GPR18);
50
  printk("\t R19 = %x\n", excPtr->GPR19);
51
  printk("\t R20 = %x\n", excPtr->GPR20);
52
  printk("\t R21 = %x\n", excPtr->GPR21);
53
  printk("\t R22 = %x\n", excPtr->GPR22);
54
  printk("\t R23 = %x\n", excPtr->GPR23);
55
  printk("\t R24 = %x\n", excPtr->GPR24);
56
  printk("\t R25 = %x\n", excPtr->GPR25);
57
  printk("\t R26 = %x\n", excPtr->GPR26);
58
  printk("\t R27 = %x\n", excPtr->GPR27);
59
  printk("\t R28 = %x\n", excPtr->GPR28);
60
  printk("\t R29 = %x\n", excPtr->GPR29);
61
  printk("\t R30 = %x\n", excPtr->GPR30);
62
  printk("\t R31 = %x\n", excPtr->GPR31);
63
  printk("\t CR = %x\n", excPtr->EXC_CR);
64
  printk("\t CTR = %x\n", excPtr->EXC_CTR);
65
  printk("\t XER = %x\n", excPtr->EXC_XER);
66
  printk("\t LR = %x\n", excPtr->EXC_LR);
67
  printk("\t MSR = %x\n", excPtr->EXC_MSR);
68
  if (excPtr->_EXC_number == ASM_DEC_VECTOR)
69
       recoverable = 1;
70
  if (excPtr->_EXC_number == ASM_SYS_VECTOR)
71
#ifdef TEST_RAW_EXCEPTION_CODE      
72
    recoverable = 1;
73
#else
74
    recoverable = 0;
75
#endif
76
    if (!recoverable) {
77
      printk("unrecoverable exception!!! Push reset button\n");
78
      while(1);
79
    }
80
}
81
 
82
void nop_except_enable(const rtems_raw_except_connect_data* ptr)
83
{
84
}
85
int except_always_enabled(const rtems_raw_except_connect_data* ptr)
86
{
87
  return 1;
88
}
89
 
90
void initialize_exceptions()
91
{
92
  int i;
93
 
94
  /*
95
   * Initialize pointer used by low level execption handling
96
   */
97
  globalExceptHdl                               = C_exception_handler;
98
  /*
99
   * Put  default_exception_vector_code_prolog at relevant exception
100
   * code entry addresses
101
   */
102
  exception_config.exceptSize                   = LAST_VALID_EXC + 1;
103
  exception_config.rawExceptHdlTbl              = &exception_table[0];
104
  exception_config.defaultRawEntry.exceptIndex  = 0;
105
  exception_config.defaultRawEntry.hdl.vector   = 0;
106
  exception_config.defaultRawEntry.hdl.raw_hdl  = default_exception_vector_code_prolog;
107
  /*
108
   * Note that next line the '&' before default_exception_vector_code_prolog_size
109
   * is not a bug as it is defined a .set directly in asm...
110
   */
111
  exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) &default_exception_vector_code_prolog_size;
112
  for (i=0; i <= exception_config.exceptSize; i++) {
113
    if (!mpc750_vector_is_valid (i)) {
114
      continue;
115
    }
116
    exception_table[i].exceptIndex      = i;
117
    exception_table[i].hdl              = exception_config.defaultRawEntry.hdl;
118
    exception_table[i].hdl.vector       = i;
119
    exception_table[i].on               = nop_except_enable;
120
    exception_table[i].off              = nop_except_enable;
121
    exception_table[i].isOn             = except_always_enabled;
122
  }
123
  if (!mpc60x_init_exceptions(&exception_config)) {
124
    BSP_panic("Exception handling initialization failed\n");
125
  }
126
  else {
127
    printk("Exception handling initialization done\n");
128
  }
129
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.