- Timestamp:
- Aug 7, 2015, 5:42:06 PM (9 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_boot/boot.c
r656 r695 1083 1083 psched->context[IDLE_TASK_INDEX][CTX_VSID_ID] = 0; 1084 1084 psched->context[IDLE_TASK_INDEX][CTX_NORUN_ID] = 0; 1085 psched->context[IDLE_TASK_INDEX][CTX_SIG_ID] = 0; 1085 1086 } 1086 1087 … … 1285 1286 psched->context[ltid][CTX_VSID_ID] = vspace_id; 1286 1287 psched->context[ltid][CTX_NORUN_ID] = ctx_norun; 1288 psched->context[ltid][CTX_SIG_ID] = 0; 1287 1289 1288 1290 psched->context[ltid][CTX_TTY_ID] = 0xFFFFFFFF; … … 1308 1310 " - ctx[VSID] = %d\n" 1309 1311 " - ctx[TRDID] = %d\n" 1310 " - ctx[NORUN] = %x\n", 1312 " - ctx[NORUN] = %x\n" 1313 " - ctx[SIG] = %x\n", 1311 1314 task[task_id].name, 1312 1315 vspace[vspace_id].name, … … 1320 1323 psched->context[ltid][CTX_VSID_ID], 1321 1324 psched->context[ltid][CTX_TRDID_ID], 1322 psched->context[ltid][CTX_NORUN_ID] ); 1325 psched->context[ltid][CTX_NORUN_ID], 1326 psched->context[ltid][CTX_SIG_ID] ); 1323 1327 #endif 1324 1328 } // end if FIT -
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 } -
soft/giet_vm/giet_kernel/ctx_handler.h
r648 r695 34 34 // ctx[35]<- BVAR |ctx[43]<- CMA_TX |ctx[51]<- COPROC |ctx[59]<- *** 35 35 // ctx[36]<- PTAB |ctx[44]<- NIC_RX |ctx[52]<- ENTRY |ctx[60]<- *** 36 // ctx[37]<- LTID |ctx[45]<- NIC_TX |ctx[53]<- ***|ctx[61]<- ***36 // ctx[37]<- LTID |ctx[45]<- NIC_TX |ctx[53]<- SIG |ctx[61]<- *** 37 37 // ctx[38]<- VSID |ctx[46]<- TIM |ctx[54]<- *** |ctx[62]<- *** 38 38 // ctx[39]<- PTPR |ctx[47]<- HBA |ctx[55]<- *** |ctx[63]<- *** … … 74 74 #define CTX_COPROC_ID 51 // cluster_xy : coprocessor coordinates 75 75 #define CTX_ENTRY_ID 52 // Virtual address of task entry point 76 #define CTX_SIG_ID 53 // bit-vector : pending signals for task 76 77 77 78 ///////////////////////////////////////////////////////////////////////////////// … … 82 83 #define NORUN_MASK_IOC 0x00000002 // Task blocked on IOC transfer 83 84 #define NORUN_MASK_COPROC 0x00000004 // Task blocked on COPROC transfer 85 86 ///////////////////////////////////////////////////////////////////////////////// 87 // Definition of the SIG bit-vector masks 88 ///////////////////////////////////////////////////////////////////////////////// 89 90 #define SIG_MASK_KILL 0x00000001 // Task will be killed at next tick 84 91 85 92 ///////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_kernel/sys_handler.c
r690 r695 232 232 if ( _strcmp( vspace[vspace_id].name, name ) == 0 ) 233 233 { 234 // check if pplication can be killed234 // check if application can be killed 235 235 if ( vspace[vspace_id].active ) return -2; 236 236 … … 249 249 static_scheduler_t* psched = (static_scheduler_t*)_schedulers[x][y][p]; 250 250 251 // release private TTY terminal if required 252 if ( psched->context[ltid][CTX_TTY_ID] < NB_TTY_CHANNELS ) 253 { 254 psched->context[ltid][CTX_TTY_ID] = 0xFFFFFFFF; 255 _atomic_increment( &_tty_channel_allocator , 0xFFFFFFFF ); 256 } 257 258 // release private TIM channel if required 259 if ( psched->context[ltid][CTX_TIM_ID] < NB_TIM_CHANNELS ) 260 { 261 psched->context[ltid][CTX_TIM_ID] = 0xFFFFFFFF; 262 _atomic_increment( &_tim_channel_allocator , 0xFFFFFFFF ); 263 } 264 265 // release private NIC_RX channel if required 266 if ( psched->context[ltid][CTX_NIC_RX_ID] < NB_NIC_CHANNELS ) 267 { 268 psched->context[ltid][CTX_NIC_RX_ID] = 0xFFFFFFFF; 269 _atomic_increment( &_nic_rx_channel_allocator , 0xFFFFFFFF ); 270 } 271 272 // release private NIC_TX channel if required 273 if ( psched->context[ltid][CTX_NIC_TX_ID] < NB_NIC_CHANNELS ) 274 { 275 psched->context[ltid][CTX_NIC_TX_ID] = 0xFFFFFFFF; 276 _atomic_increment( &_nic_tx_channel_allocator , 0xFFFFFFFF ); 277 } 278 279 // set NORUN_MASK_TASK bit 280 unsigned int* ptr = &psched->context[ltid][CTX_NORUN_ID]; 281 _atomic_or( ptr , NORUN_MASK_TASK ); 251 // set KILL signal bit 252 _atomic_or( &psched->context[ltid][CTX_SIG_ID] , SIG_MASK_KILL ); 282 253 } 283 254 284 255 #if GIET_DEBUG_EXEC 285 256 if ( _get_proctime() > GIET_DEBUG_EXEC ) 286 _printf("\n[DEBUG EXEC] exit _sys_kill_application() : %s desactivated\n", name );257 _printf("\n[DEBUG EXEC] exit _sys_kill_application() : %s will be killed\n", name ); 287 258 #endif 288 259 … … 848 819 } 849 820 821 ///////////////////////////////////////// 822 // NOTE: not a syscall 823 int _sys_tty_release() 824 { 825 // release one TTY terminal 826 _atomic_increment( &_tty_channel_allocator , 0xFFFFFFFF ); 827 828 return 0; 829 } 830 850 831 ///////////////////////////////////////////////// 851 832 int _sys_tty_write( const char* buffer, … … 942 923 return 0; 943 924 } 925 } 926 927 //////////////////// 928 // NOTE: not a syscall 929 int _sys_tim_release() 930 { 931 // release one timer 932 _atomic_increment( &_tim_channel_allocator, 0xFFFFFFFF ); 933 934 return 0; 944 935 } 945 936 … … 1225 1216 return nic_channel; 1226 1217 } // end _sys_nic_alloc() 1218 1219 1220 //////////////////////////////////////// 1221 // NOTE: not a syscall 1222 int _sys_nic_release( unsigned int is_rx ) 1223 { 1224 if ( is_rx ) 1225 _atomic_increment( &_nic_rx_channel_allocator , 0xFFFFFFFF ); 1226 else 1227 _atomic_increment( &_nic_tx_channel_allocator , 0xFFFFFFFF ); 1228 1229 return 0; 1230 } 1227 1231 1228 1232 -
soft/giet_vm/giet_kernel/sys_handler.h
r688 r695 118 118 int _sys_tty_alloc( unsigned int shared ); 119 119 120 int _sys_tty_release(); 121 120 122 int _sys_tty_write( const char* buffer, 121 123 unsigned int length, … … 131 133 132 134 int _sys_tim_alloc(); 135 136 int _sys_tim_release(); 133 137 134 138 int _sys_tim_start( unsigned int period ); … … 144 148 unsigned int ymax ); 145 149 150 int _sys_nic_release( unsigned int is_rx ); 146 151 147 152 int _sys_nic_start( unsigned int is_rx,
Note: See TracChangeset
for help on using the changeset viewer.