Changeset 696 for soft/giet_vm/giet_kernel
- Timestamp:
- Aug 7, 2015, 5:42:06 PM (9 years ago)
- Location:
- soft/giet_vm/giet_kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_kernel/ctx_handler.c
r695 r696 60 60 // set NORUN_MASK_TASK bit 61 61 _atomic_or( &psched->context[ltid][CTX_NORUN_ID], NORUN_MASK_TASK ); 62 } 63 64 65 ////////////////// 66 static void _ctx_exec_task( unsigned int ltid ) 67 { 68 // get scheduler address 69 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 70 71 // TODO: reload .data segment 72 73 // find initial stack pointer 74 mapping_header_t * header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE; 75 mapping_task_t * task = _get_task_base(header); 76 mapping_vseg_t * vseg = _get_vseg_base(header); 77 unsigned int task_id = psched->context[ltid][CTX_GTID_ID]; 78 unsigned int vseg_id = task[task_id].stack_vseg_id; 79 unsigned int sp_value = vseg[vseg_id].vbase + vseg[vseg_id].length; 80 81 // reset task context: RA / SR / SP / EPC / NORUN 82 psched->context[ltid][CTX_RA_ID] = (unsigned int)&_ctx_eret; 83 psched->context[ltid][CTX_SR_ID] = GIET_SR_INIT_VALUE; 84 psched->context[ltid][CTX_SP_ID] = sp_value; 85 psched->context[ltid][CTX_EPC_ID] = psched->context[ltid][CTX_ENTRY_ID]; 86 psched->context[ltid][CTX_NORUN_ID] = 0; 62 87 } 63 88 … … 128 153 // acknowledge signal 129 154 _atomic_and( &psched->context[next_task_id][CTX_SIG_ID], ~SIG_MASK_KILL ); 130 131 // skip 132 continue; 155 } 156 157 // this task needs to be executed 158 if ( psched->context[next_task_id][CTX_SIG_ID] & SIG_MASK_EXEC ) 159 { 160 _ctx_exec_task( next_task_id ); 161 162 // acknowledge signal 163 _atomic_and( &psched->context[next_task_id][CTX_SIG_ID], ~SIG_MASK_EXEC ); 133 164 } 134 165 -
soft/giet_vm/giet_kernel/ctx_handler.h
r695 r696 89 89 90 90 #define SIG_MASK_KILL 0x00000001 // Task will be killed at next tick 91 #define SIG_MASK_EXEC 0x00000002 // Task will be executed at next tick 91 92 92 93 ///////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_kernel/sys_handler.c
r695 r696 277 277 mapping_vspace_t * vspace = _get_vspace_base(header); 278 278 mapping_task_t * task = _get_task_base(header); 279 mapping_vseg_t * vseg = _get_vseg_base(header);280 279 281 280 unsigned int vspace_id; 282 281 unsigned int task_id; 283 unsigned int vseg_id;284 285 282 unsigned int y_size = header->y_size; 286 283 … … 307 304 unsigned int ltid = task[task_id].ltid; 308 305 309 // get scheduler pointer for theprocessor running the task306 // get scheduler pointer for processor running the task 310 307 static_scheduler_t* psched = (static_scheduler_t*)_schedulers[x][y][p]; 311 308 312 // sp_value : initial stack pointer 313 vseg_id = task[task_id].stack_vseg_id; 314 unsigned int sp_value = vseg[vseg_id].vbase + vseg[vseg_id].length; 315 316 // epc value : task entry point 317 unsigned int epc_value = psched->context[ltid][CTX_ENTRY_ID]; 318 319 // ra_value : initial return address 320 unsigned int ra_value = (unsigned int)(&_ctx_eret); 321 322 // initialise task context: RA / SR / EPC / SP / NORUN slots 323 psched->context[ltid][CTX_RA_ID] = ra_value; 324 psched->context[ltid][CTX_SR_ID] = GIET_SR_INIT_VALUE; 325 psched->context[ltid][CTX_SP_ID] = sp_value; 326 psched->context[ltid][CTX_EPC_ID] = epc_value; 327 psched->context[ltid][CTX_NORUN_ID] = 0; 309 // set EXEC signal bit 310 _atomic_or( &psched->context[ltid][CTX_SIG_ID] , SIG_MASK_EXEC ); 311 } 328 312 329 313 #if GIET_DEBUG_EXEC 330 314 if ( _get_proctime() > GIET_DEBUG_EXEC ) 331 _printf("\n[DEBUG EXEC] _sys_exec_application() start task %d on P[%d,%d,%d]\n" 332 " - ctx_ra = %x\n" 333 " - ctx_sp = %x\n" 334 " - ctx_epc = %x\n", 335 task_id , x , y , p , ra_value , sp_value , epc_value ); 336 #endif 337 } 338 339 #if GIET_DEBUG_EXEC 340 if ( _get_proctime() > GIET_DEBUG_EXEC ) 341 _printf("\n[DEBUG EXEC] exit _sys_exec_application() at cycle %d : %s activated\n", 315 _printf("\n[DEBUG EXEC] exit _sys_exec_application() at cycle %d : %s will be executed\n", 342 316 _get_proctime() , name ); 343 317 #endif
Note: See TracChangeset
for help on using the changeset viewer.