Changeset 199 for soft/giet_vm/sys/exc_handler.c
- Timestamp:
- Aug 9, 2012, 2:38:06 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sys/exc_handler.c
r189 r199 10 10 11 11 #include <exc_handler.h> 12 #include <ctx_handler.h> 12 13 #include <sys_handler.h> 13 14 #include <drivers.h> … … 53 54 }; 54 55 55 static const char *exc_message_causes[] = {56 " \n\nException : strange unknown cause\n",57 " \n\nException : illegal read address \n",58 " \n\nException : illegal write address\n",59 " \n\nException : inst bus error \n",60 " \n\nException : data bus error \n",61 " \n\nException : breakpoint \n",62 " \n\nException : reserved instruction \n",63 " \n\nException : illegal coproc access\n"64 " \n\nException : arithmetic overflow \n",56 static const char* exc_type[] = { 57 "strange unknown cause", 58 "illegal read address", 59 "illegal write address", 60 "inst bus error", 61 "data bus error", 62 "breakpoint", 63 "reserved instruction", 64 "illegal coproc access" 65 "arithmetic overflow", 65 66 }; 66 67 67 static void _ cause(unsigned int msg_cause)68 static void _display_cause(unsigned int type) 68 69 { 69 _puts( (char*)(exc_message_causes[msg_cause]) ); 70 _puts("\n - Cycle : "); 70 _puts("\n[GIET] Exception for task "); 71 _putd( _get_current_task_id() ); 72 _puts(" on processor "); 73 _putd( _procid() ); 74 _puts(" at cycle "); 71 75 _putd( _proctime() ); 72 _puts("\n - Processor : "); 73 _putd( _procid() ); 74 _puts("\n - Task : "); 75 _putd( _get_current_task_id() ); 76 _puts("\n - type : "); 77 _puts( (char*)exc_type[type] ); 76 78 _puts("\n - EPC : "); 77 79 _putw( _get_epc() ); … … 79 81 _putw( _get_bvar() ); 80 82 _puts("\n"); 81 _exit(); 83 84 // goes to sleeping state 85 unsigned int task_id = _get_current_task_id(); 86 _set_context_slot( task_id, CTX_RUN_ID, 0 ); 87 88 // deschedule 89 _ctx_switch(); 82 90 } 83 91 84 static void _cause_ukn() { _ cause(0); }85 static void _cause_adel() { _ cause(1); }86 static void _cause_ades() { _ cause(2); }87 static void _cause_ibe() { _ cause(3); }88 static void _cause_dbe() { _ cause(4); }89 static void _cause_bp() { _ cause(5); }90 static void _cause_ri() { _ cause(6); }91 static void _cause_cpu() { _ cause(7); }92 static void _cause_ovf() { _ cause(8); }92 static void _cause_ukn() { _display_cause(0); } 93 static void _cause_adel() { _display_cause(1); } 94 static void _cause_ades() { _display_cause(2); } 95 static void _cause_ibe() { _display_cause(3); } 96 static void _cause_dbe() { _display_cause(4); } 97 static void _cause_bp() { _display_cause(5); } 98 static void _cause_ri() { _display_cause(6); } 99 static void _cause_cpu() { _display_cause(7); } 100 static void _cause_ovf() { _display_cause(8); } 93 101
Note: See TracChangeset
for help on using the changeset viewer.