Changeset 695 for soft/giet_vm/giet_kernel/ctx_handler.c
- Timestamp:
- Aug 7, 2015, 5:42:06 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/ctx_handler.c
r648 r695 7 7 8 8 #include <ctx_handler.h> 9 #include <sys_handler.h> 9 10 #include <giet_config.h> 10 11 #include <hard_config.h> … … 22 23 // allocated in boot.c or kernel_init.c files 23 24 extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX]; 25 26 ////////////////// 27 static void _ctx_kill_task( unsigned int ltid ) 28 { 29 // get scheduler address 30 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 31 32 // release private TTY terminal if required 33 if ( psched->context[ltid][CTX_TTY_ID] < NB_TTY_CHANNELS ) 34 { 35 psched->context[ltid][CTX_TTY_ID] = 0xFFFFFFFF; 36 _sys_tty_release(); 37 } 38 39 // release private TIM channel if required 40 if ( psched->context[ltid][CTX_TIM_ID] < NB_TIM_CHANNELS ) 41 { 42 psched->context[ltid][CTX_TIM_ID] = 0xFFFFFFFF; 43 _sys_tim_release(); 44 } 45 46 // release private NIC_RX channel if required 47 if ( psched->context[ltid][CTX_NIC_RX_ID] < NB_NIC_CHANNELS ) 48 { 49 psched->context[ltid][CTX_NIC_RX_ID] = 0xFFFFFFFF; 50 _sys_nic_release( 1 ); 51 } 52 53 // release private NIC_TX channel if required 54 if ( psched->context[ltid][CTX_NIC_TX_ID] < NB_NIC_CHANNELS ) 55 { 56 psched->context[ltid][CTX_NIC_TX_ID] = 0xFFFFFFFF; 57 _sys_nic_release( 0 ); 58 } 59 60 // set NORUN_MASK_TASK bit 61 _atomic_or( &psched->context[ltid][CTX_NORUN_ID], NORUN_MASK_TASK ); 62 } 63 24 64 25 65 ////////////////////////////////// … … 40 80 " - CTX_SP = %x\n" 41 81 " - CTX_NORUN = %x\n" 82 " - CTX_SIG = %x\n" 42 83 "########## %s\n", 43 84 x , y , p , ltid , … … 50 91 psched->context[ltid][CTX_SP_ID], 51 92 psched->context[ltid][CTX_NORUN_ID], 93 psched->context[ltid][CTX_SIG_ID], 52 94 string ); 53 95 } // _ctx_display() … … 78 120 { 79 121 next_task_id = tid % tasks; 122 123 // this task needs to be killed 124 if ( psched->context[next_task_id][CTX_SIG_ID] & SIG_MASK_KILL ) 125 { 126 _ctx_kill_task( next_task_id ); 127 128 // acknowledge signal 129 _atomic_and( &psched->context[next_task_id][CTX_SIG_ID], ~SIG_MASK_KILL ); 130 131 // skip 132 continue; 133 } 134 80 135 // test if the task is runable 81 136 if ( psched->context[next_task_id][CTX_NORUN_ID] == 0 ) 82 137 { 83 138 found = 1; 139 // TODO: don't break to process all pending signals. 84 140 break; 85 141 }
Note: See TracChangeset
for help on using the changeset viewer.