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