Index: soft/giet_vm/giet_kernel/ctx_handler.c
===================================================================
--- soft/giet_vm/giet_kernel/ctx_handler.c	(revision 647)
+++ soft/giet_vm/giet_kernel/ctx_handler.c	(revision 648)
@@ -109,5 +109,4 @@
         // makes context switch
         _task_switch( curr_ctx_vaddr , next_ctx_vaddr );
-
     }
 } //end _ctx_switch()
Index: soft/giet_vm/giet_kernel/ctx_handler.h
===================================================================
--- soft/giet_vm/giet_kernel/ctx_handler.h	(revision 647)
+++ soft/giet_vm/giet_kernel/ctx_handler.h	(revision 648)
@@ -33,5 +33,5 @@
 // ctx[34]<- SR    |ctx[42]<- CMA_RX |ctx[50]<- NORUN  |ctx[58]<- ***
 // ctx[35]<- BVAR  |ctx[43]<- CMA_TX |ctx[51]<- COPROC |ctx[59]<- ***
-// ctx[36]<- PTAB  |ctx[44]<- NIC_RX |ctx[52]<- ***    |ctx[60]<- ***
+// ctx[36]<- PTAB  |ctx[44]<- NIC_RX |ctx[52]<- ENTRY  |ctx[60]<- ***
 // ctx[37]<- LTID  |ctx[45]<- NIC_TX |ctx[53]<- ***    |ctx[61]<- ***
 // ctx[38]<- VSID  |ctx[46]<- TIM    |ctx[54]<- ***    |ctx[62]<- ***
@@ -73,4 +73,5 @@
 #define CTX_NORUN_ID     50    // bit-vector : task runable if all zero
 #define CTX_COPROC_ID    51    // cluster_xy : coprocessor coordinates
+#define CTX_ENTRY_ID     52    // Virtual address of task entry point
 
 /////////////////////////////////////////////////////////////////////////////////
Index: soft/giet_vm/giet_kernel/irq_handler.c
===================================================================
--- soft/giet_vm/giet_kernel/irq_handler.c	(revision 647)
+++ soft/giet_vm/giet_kernel/irq_handler.c	(revision 648)
@@ -252,10 +252,10 @@
     unsigned int x              = cluster_xy >> Y_WIDTH;
     unsigned int y              = cluster_xy & ((1<<Y_WIDTH)-1);
-    unsigned int lpid           = gpid & ((1<<P_WIDTH)-1);
+    unsigned int p              = gpid & ((1<<P_WIDTH)-1);
     unsigned int irq_id;
     unsigned int irq_type;
 
     // get the highest priority active IRQ index 
-    unsigned int icu_out_index = lpid * IRQ_PER_PROCESSOR;
+    unsigned int icu_out_index = p * IRQ_PER_PROCESSOR;
 
     _xcu_get_index( cluster_xy, icu_out_index, &irq_id, &irq_type );
@@ -283,5 +283,5 @@
 _nolock_printf("\n[DEBUG IRQS] _irq_demux() Processor[%d,%d,%d] enters at cycle %d\n"
                " irq_type = %s / irq_id = %d / isr_type = %s / channel = %d\n",
-               x , y , lpid , _get_proctime() ,
+               x , y , p , _get_proctime() ,
                _irq_type_str[irq_type] , irq_id , _isr_type_str[isr_type] , channel );   
 #endif
@@ -309,5 +309,5 @@
                     " - irq_id   = %d\n"
                     " - isr_type = %s\n",
-                    x, y, lpid, _get_proctime(), 
+                    x, y, p, _get_proctime(), 
                     _irq_type_str[irq_type] , irq_id , _isr_type_str[isr_type] );   
             _exit();
@@ -327,9 +327,9 @@
     unsigned int x          = cluster_xy >> Y_WIDTH;
     unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
-    unsigned int lpid       = gpid & ((1<<P_WIDTH)-1);
+    unsigned int p          = gpid & ((1<<P_WIDTH)-1);
 
     _printf("\n[GIET WARNING] IRQ handler called but no active IRQ "
             "on processor[%d,%d,%d] at cycle %d\n",
-            x, y, lpid, _get_proctime() );
+            x, y, p, _get_proctime() );
 }
 
Index: soft/giet_vm/giet_kernel/kernel_init.c
===================================================================
--- soft/giet_vm/giet_kernel/kernel_init.c	(revision 647)
+++ soft/giet_vm/giet_kernel/kernel_init.c	(revision 648)
@@ -266,7 +266,7 @@
     //            initialisation, from values stored in the tasks contexts.
     //          - set CTX_RA slot  with the kernel _ctx_eret() virtual address.
-    //          - set CTX_EPC slot that must contain the task entry point, 
+    //          - set CTX_ENTRY slot that must contain the task entry point, 
     //            and contain only at this point the virtual address of the 
-    //            memory slot containing this entry point. 
+    //            memory word containing this entry point. 
     ////////////////////////////////////////////////////////////////////////////
 
@@ -283,15 +283,16 @@
         _ptabs_ptprs[vsid][x][y] = ptpr;
 
-        // set the ptpr to use the local page table
+        // set the PTPR to use the local page table
         asm volatile( "mtc2    %0,   $0"
                       : : "r" (ptpr) );
 
-        // compute ctx_ra
+        // set CTX_RA slot
         unsigned int ctx_ra = (unsigned int)(&_ctx_eret);
         _set_task_slot( x, y, p, ltid, CTX_RA_ID, ctx_ra );
 
-        // compute ctx_epc
-        unsigned int* ptr = (unsigned int*)_get_task_slot(x,y,p,ltid,CTX_EPC_ID);
-        _set_task_slot( x , y , p , ltid , CTX_EPC_ID , *ptr );
+        // set CTX_ENTRY slot
+        unsigned int* ptr = (unsigned int*)_get_task_slot(x , y , p , ltid , CTX_ENTRY_ID);
+        unsigned int ctx_entry = *ptr;
+        _set_task_slot( x , y , p , ltid , CTX_ENTRY_ID , ctx_entry );
 
 #if GIET_DEBUG_INIT
@@ -300,11 +301,10 @@
         " - ptabs_vaddr[%d][%d][%d] = %x\n"
         " - ptabs_paddr[%d][%d][%d] = %l\n"
-        " - ctx_epc              = %x\n"
+        " - ctx_entry            = %x\n"
         " - ctx_ra               = %x\n",
         x , y , p , ltid ,  
         vsid , x , y , ptab ,
         vsid , x , y , ((unsigned long long)ptpr)<<13 ,
-        _get_task_slot( x, y, p, ltid, CTX_EPC_ID ),
-        _get_task_slot( x, y, p, ltid, CTX_RA_ID ) );
+        ctx_entry, ctx_ra );
 #endif
 
@@ -316,10 +316,9 @@
 
     ////////////////////////////////////////////////////////////////////////////
-    // step 3 : - Each processor complete idle task context initialisation,
-    //            (only the CTX_SP, CTX_RA, CTX_EPC slot, because the CTX_PTPR
-    //            and CTX_PTAB slots have been initialised in boot code)
+    // step 3 : - Each processor complete idle task context initialisation.
+    //            Only CTX_SP, CTX_RA, CTX_EPC slots, because other slots
+    //            have been initialised in boot code)
     //            The 4 Kbytes idle stack is implemented in the scheduler itself.
-    //          - Each processor starts TICK timer, as soon as at least one task
-    //            is allocated.
+    //          - Each processor starts TICK timer, if at least one task.
     //          - P[0,0,0] initialises FAT (not done before, because it must 
     //            be done after the _ptabs_vaddr[v][x][y] array initialisation, 
@@ -327,11 +326,11 @@
     ////////////////////////////////////////////////////////////////////////////
 
-    unsigned int sp  = ((unsigned int)psched) + 0x2000;
-    unsigned int ra  = (unsigned int)(&_ctx_eret);
-    unsigned int epc = (unsigned int)(&_idle_task);
-
-    _set_task_slot( x , y , p , IDLE_TASK_INDEX , CTX_SP_ID  , sp  );
-    _set_task_slot( x , y , p , IDLE_TASK_INDEX , CTX_RA_ID  , ra  );
-    _set_task_slot( x , y , p , IDLE_TASK_INDEX , CTX_EPC_ID , epc );
+    unsigned int sp    = ((unsigned int)psched) + 0x2000;
+    unsigned int ra    = (unsigned int)(&_ctx_eret);
+    unsigned int entry = (unsigned int)(&_idle_task);
+
+    _set_task_slot( x , y , p , IDLE_TASK_INDEX , CTX_SP_ID  , sp    );
+    _set_task_slot( x , y , p , IDLE_TASK_INDEX , CTX_RA_ID  , ra    );
+    _set_task_slot( x , y , p , IDLE_TASK_INDEX , CTX_ENTRY_ID , entry );
 
     if (tasks > 0) _xcu_timer_start( cluster_xy, p, GIET_TICK_VALUE ); 
@@ -358,7 +357,8 @@
 
     ////////////////////////////////////////////////////////////////////////////
-    // step 4 : Each processor compute values for registers SP, SR, PTPR, EPC,
-    //          corresponding to the first allocated task (can be idle task)
-    //          and jumps to user code.
+    // step 4 : Each processor computes the task index (ltid), and the values
+    //          to initialize the SP, SR, PTPR, EPC registers.
+    //          It jumps to a runable task if possible, and jumps to IDLE-TASK 
+    //          if no task allocated or no runable task.
     ////////////////////////////////////////////////////////////////////////////
 
@@ -366,14 +366,29 @@
                             x, y, p );
 
-    if (tasks == 0) ltid = IDLE_TASK_INDEX;
-    else            ltid = 0;
-
+    // default value for ltid
+    ltid = IDLE_TASK_INDEX;
+
+    // scan allocated tasks to find a runable task
+    unsigned int  task_id; 
+    for ( task_id = 0 ; task_id < tasks ; task_id++ )
+    {
+        if ( _get_task_slot( x, y, p, task_id, CTX_NORUN_ID ) == 0 )
+        {
+            ltid = task_id;
+            break;
+        }
+    }
+
+    // update scheduler
+    psched->current = ltid;
+
+    // get values from selected task context
     unsigned int sp_value   = _get_task_slot( x, y, p, ltid, CTX_SP_ID);
     unsigned int sr_value   = _get_task_slot( x, y, p, ltid, CTX_SR_ID);
     unsigned int ptpr_value = _get_task_slot( x, y, p, ltid, CTX_PTPR_ID);
-    unsigned int epc_value  = _get_task_slot( x, y, p, ltid, CTX_EPC_ID);
-
-#if GIET_DEBUG_INIT
-_printf("\n[DEBUG KINIT] P[%d,%d,%d] jumps to user code at cycle %d\n"
+    unsigned int epc_value  = _get_task_slot( x, y, p, ltid, CTX_ENTRY_ID);
+
+#if GIET_DEBUG_INIT
+_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes kernel_init at cycle %d\n"
         " ltid = %d / sp = %x / sr = %x / ptpr = %x / epc = %x\n",
         x , y , p , _get_proctime() ,
Index: soft/giet_vm/giet_kernel/sys_handler.c
===================================================================
--- soft/giet_vm/giet_kernel/sys_handler.c	(revision 647)
+++ soft/giet_vm/giet_kernel/sys_handler.c	(revision 648)
@@ -206,4 +206,163 @@
 };
 
+
+//////////////////////////////////////////////////////////////////////////////
+//           Applications related syscall handlers 
+//////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////
+int _sys_kill_application( char* name )
+{
+    mapping_header_t * header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
+    mapping_vspace_t * vspace  = _get_vspace_base(header);
+    mapping_task_t   * task    = _get_task_base(header);
+
+    unsigned int vspace_id;
+    unsigned int task_id;
+    unsigned int y_size = header->y_size;
+
+#if GIET_DEBUG_EXEC
+if ( _get_proctime() > GIET_DEBUG_EXEC )
+_printf("\n[DEBUG EXEC] enters _sys_kill_application() for %s\n", name );
+#endif
+
+    // scan vspaces
+    for (vspace_id = 0; vspace_id < header->vspaces; vspace_id++) 
+    {
+        if ( _strcmp( vspace[vspace_id].name, name ) == 0 ) 
+        {
+            // check if pplication can be killed
+            if ( vspace[vspace_id].active ) return -2;
+
+            // scan tasks in vspace
+            for (task_id = vspace[vspace_id].task_offset; 
+                 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks); 
+                 task_id++) 
+            {
+                unsigned int cid   = task[task_id].clusterid;
+                unsigned int x     = cid / y_size;
+                unsigned int y     = cid % y_size;
+                unsigned int p     = task[task_id].proclocid;
+                unsigned int ltid  = task[task_id].ltid;
+
+                // get scheduler pointer for processor running the task
+                static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
+
+                // release private TTY peripheral if required
+                if ( psched->context[ltid][CTX_TTY_ID] < NB_TTY_CHANNELS ) 
+                {
+                    psched->context[ltid][CTX_TTY_ID] = 0xFFFFFFFF;
+                    _atomic_increment( &_tty_channel_allocator , 0xFFFFFFFF );
+                }
+
+                // set NORUN_MASK_TASK bit
+                unsigned int*       ptr     = &psched->context[ltid][CTX_NORUN_ID];
+                _atomic_or( ptr , NORUN_MASK_TASK );
+            } 
+
+#if GIET_DEBUG_EXEC 
+if ( _get_proctime() > GIET_DEBUG_EXEC )
+_printf("\n[DEBUG EXEC] exit _sys_kill_application() : %s desactivated\n", name );
+#endif
+
+            return 0;
+        }
+    } 
+
+#if GIET_DEBUG_EXEC 
+if ( _get_proctime() > GIET_DEBUG_EXEC )
+_printf("\n[DEBUG EXEC] exit _sys_kill_application() : %s not found\n", name );
+#endif
+
+    return -1;    // not found 
+
+}  // end _sys_kill_application()
+    
+///////////////////////////////////////
+int _sys_exec_application( char* name )
+{
+    mapping_header_t * header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
+    mapping_vspace_t * vspace  = _get_vspace_base(header);
+    mapping_task_t   * task    = _get_task_base(header);
+    mapping_vseg_t   * vseg    = _get_vseg_base(header);
+
+    unsigned int vspace_id;
+    unsigned int task_id;
+    unsigned int vseg_id;
+
+    unsigned int y_size = header->y_size;
+
+#if GIET_DEBUG_EXEC 
+if ( _get_proctime() > GIET_DEBUG_EXEC )
+_printf("\n[DEBUG EXEC] enters _sys_exec_application() at cycle %d for %s\n",
+         _get_proctime() , name );
+#endif
+
+    // scan vspaces
+    for (vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++) 
+    {
+        if ( _strcmp( vspace[vspace_id].name, name ) == 0 ) 
+        {
+            // scan tasks in vspace
+            for (task_id = vspace[vspace_id].task_offset; 
+                 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks); 
+                 task_id++) 
+            {
+                unsigned int cid   = task[task_id].clusterid;
+                unsigned int x     = cid / y_size;
+                unsigned int y     = cid % y_size;
+                unsigned int p     = task[task_id].proclocid;
+                unsigned int ltid  = task[task_id].ltid;
+
+                // get scheduler pointer for the processor running the task
+                static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
+
+                // sp_value : initial stack pointer 
+                vseg_id = task[task_id].stack_vseg_id;
+                unsigned int sp_value = vseg[vseg_id].vbase + vseg[vseg_id].length;
+
+                // epc value : task entry point
+                unsigned int  epc_value = psched->context[ltid][CTX_ENTRY_ID];
+
+                // ra_value : initial return address
+                unsigned int ra_value = (unsigned int)(&_ctx_eret);
+
+                // initialise task context: RA / SR / EPC / SP / NORUN slots
+                psched->context[ltid][CTX_RA_ID]    = ra_value;
+                psched->context[ltid][CTX_SR_ID]    = GIET_SR_INIT_VALUE;
+                psched->context[ltid][CTX_SP_ID]    = sp_value;
+                psched->context[ltid][CTX_EPC_ID]   = epc_value;
+                psched->context[ltid][CTX_NORUN_ID] = 0;
+
+#if GIET_DEBUG_EXEC 
+if ( _get_proctime() > GIET_DEBUG_EXEC )
+_printf("\n[DEBUG EXEC] _sys_exec_application() start task %d on P[%d,%d,%d]\n"
+        " - ctx_ra    = %x\n"
+        " - ctx_sp    = %x\n"
+        " - ctx_epc   = %x\n",
+        task_id , x , y , p , ra_value , sp_value , epc_value );
+#endif
+            } 
+
+#if GIET_DEBUG_EXEC 
+if ( _get_proctime() > GIET_DEBUG_EXEC )
+_printf("\n[DEBUG EXEC] exit _sys_exec_application() at cycle %d : %s activated\n",
+        _get_proctime() , name );
+#endif
+
+            return 0;   // application found and activated
+        }
+    }
+
+#if GIET_DEBUG_EXEC 
+if ( _get_proctime() > GIET_DEBUG_EXEC )
+_printf("\n[DEBUG EXEC] exit _sys_exec_application() at cycle %d : %s not found\n",
+         _get_proctime() , name );
+#endif
+
+    return -1;    // not found 
+
+}  // end _sys_exec_application()
+    
 
 //////////////////////////////////////////////////////////////////////////////
@@ -624,10 +783,11 @@
     if ( channel >= NB_TTY_CHANNELS )
     {
+        _atomic_increment( &_tty_channel_allocator , 0xFFFFFFFF );
         _printf("\n[GIET_ERROR] in _sys_tty_alloc() : not enough TTY channels\n");
         return -1;
     }
-    else
-    {
-    }
+
+    // reset kernel buffer for allocated TTY channel
+    _tty_rx_full[channel] = 0;
 
     // allocate a WTI mailbox to the calling proc if external IRQ
@@ -1425,9 +1585,9 @@
 
 
-////////////////////////
-int _sys_fbf_cma_init_buf(void*        buf0_vbase, 
-                          void*        buf1_vbase, 
-                          void*        sts0_vaddr,
-                          void*        sts1_vaddr )
+///////////////////////////////////////////////////
+int _sys_fbf_cma_init_buf( void*        buf0_vbase, 
+                           void*        buf1_vbase, 
+                           void*        sts0_vaddr,
+                           void*        sts1_vaddr )
 {
 #if NB_CMA_CHANNELS > 0
@@ -1447,5 +1607,5 @@
     if ( channel >= NB_CMA_CHANNELS )
     {
-        _printf("\n[GIET ERROR] in _fbf_cma_init_buf() : CMA channel index too large\n");
+        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : CMA channel index too large\n");
         return -1;
     }
@@ -1469,5 +1629,5 @@
          ((unsigned int)buf1_vbase & 0x3F) ) 
     {
-        _printf("\n[GIET ERROR] in _fbf_cma_inti_buf() : user buffer not aligned\n");
+        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : user buffer not aligned\n");
         return -1;
     }
@@ -1477,5 +1637,5 @@
          ((unsigned int)sts1_vaddr & 0x3F) )
     {
-        _printf("\n[GIET ERROR] in _fbf_cma_init_buf() : user buffer status not aligned\n");
+        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : user status not aligned\n");
         return -1;
     }
@@ -1496,5 +1656,5 @@
     if ((flags & PTE_U) == 0) 
     {
-        _printf("\n[GIET ERROR] in _fbf_cma_start() : buf0 not in user space\n");
+        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : buf0 not in user space\n");
         return -1;
     }
@@ -1504,5 +1664,5 @@
     if ((flags & PTE_U) == 0) 
     {
-        _printf("\n[GIET ERROR] in _fbf_cma_start() : sts0 not in user space\n");
+        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : sts0 not in user space\n");
         return -1;
     }
@@ -1517,5 +1677,5 @@
     if ((flags & PTE_U) == 0) 
     {
-        _printf("\n[GIET ERROR] in _fbf_cma_start() : buf1 not in user space\n");
+        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : buf1 not in user space\n");
         return -1;
     }
@@ -1525,5 +1685,5 @@
     if ((flags & PTE_U) == 0) 
     {
-        _printf("\n[GIET ERROR] in _fbf_cma_start() : sts1 not in user space\n");
+        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : sts1 not in user space\n");
         return -1;
     }
@@ -1696,5 +1856,5 @@
     while ( full )
     {  
-        // INVAL L2 cache copy of user buffer descriptor,
+        // INVAL L2 cache copy of user buffer status     
         // because it has been modified in RAM by the CMA component 
         _mmc_inval( buf_sts_paddr , 4 );        
@@ -1810,101 +1970,4 @@
 } 
 
-///////////////////////////////////////
-int _sys_kill_application( char* name )
-{
-    mapping_header_t * header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
-    mapping_vspace_t * vspace  = _get_vspace_base(header);
-    mapping_task_t   * task    = _get_task_base(header);
-
-    unsigned int vspace_id;
-    unsigned int task_id;
-    unsigned int y_size = header->y_size;
-
-    // scan vspaces
-    for (vspace_id = 0; vspace_id < header->vspaces; vspace_id++) 
-    {
-        if ( _strcmp( vspace[vspace_id].name, name ) == 0 ) 
-        {
-            // scan tasks in vspace
-            for (task_id = vspace[vspace_id].task_offset; 
-                 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks); 
-                 task_id++) 
-            {
-                unsigned int cid   = task[task_id].clusterid;
-                unsigned int x     = cid / y_size;
-                unsigned int y     = cid % y_size;
-                unsigned int p     = task[task_id].proclocid;
-                unsigned int ltid  = task[task_id].ltid;
-
-                // set NORUN_MASK_TASK bit
-                static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
-                unsigned int*       ptr     = &psched->context[ltid][CTX_NORUN_ID];
-                _atomic_or( ptr , NORUN_MASK_TASK );
-            } 
-            return 0;
-        }
-    } 
-    return -1;    // not found 
-}
-    
-///////////////////////////////////////
-int _sys_exec_application( char* name )
-{
-    mapping_header_t * header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
-    mapping_vspace_t * vspace  = _get_vspace_base(header);
-    mapping_task_t   * task    = _get_task_base(header);
-    mapping_vseg_t   * vseg    = _get_vseg_base(header);
-
-    unsigned int vspace_id;
-    unsigned int task_id;
-    unsigned int vseg_id;
-
-    unsigned int y_size = header->y_size;
-
-    // scan vspaces
-    for (vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++) 
-    {
-        if ( _strcmp( vspace[vspace_id].name, name ) == 0 ) 
-        {
-            // scan tasks in vspace
-            for (task_id = vspace[vspace_id].task_offset; 
-                 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks); 
-                 task_id++) 
-            {
-                unsigned int cid   = task[task_id].clusterid;
-                unsigned int x     = cid / y_size;
-                unsigned int y     = cid % y_size;
-                unsigned int p     = task[task_id].proclocid;
-                unsigned int ltid  = task[task_id].ltid;
-
-                // compute stack pointer value (sp_value)
-                vseg_id = task[task_id].stack_vseg_id;
-                unsigned int sp_value = vseg[vseg_id].vbase + vseg[vseg_id].length;
-
-                // compute task entry point value (epc_value)
-                vseg_id = vspace[vspace_id].start_vseg_id;     
-                unsigned int* vaddr = (unsigned int*)( vseg[vseg_id].vbase + 
-                                                       ((task[task_id].startid)<<2) );
-                unsigned int  epc_value = *vaddr;
-
-                // compute reurn address value (ra_value)
-                unsigned int ra_value = (unsigned int)(&_ctx_eret);
-
-                // get scheduler pointer 
-                static_scheduler_t* psched  = (static_scheduler_t*)_schedulers[x][y][p];
-
-                // initialise task context: RA / SR / EPC / SP / NORUN slots
-                psched->context[ltid][CTX_RA_ID]    = ra_value;
-                psched->context[ltid][CTX_SR_ID]    = GIET_SR_INIT_VALUE;
-                psched->context[ltid][CTX_SP_ID]    = sp_value;
-                psched->context[ltid][CTX_EPC_ID]   = epc_value;
-                psched->context[ltid][CTX_NORUN_ID] = 0;
-            } 
-            return 0;
-        }
-    }
-    return -1;    // not found 
-}
-    
 /////////////////////////
 int _sys_context_switch() 
