Index: /soft/giet_vm/giet_kernel/ctx_handler.c
===================================================================
--- /soft/giet_vm/giet_kernel/ctx_handler.c	(revision 390)
+++ /soft/giet_vm/giet_kernel/ctx_handler.c	(revision 391)
@@ -103,6 +103,13 @@
 void _idle_task() 
 {
+    unsigned int gpid       = _get_procid();
+    unsigned int cluster_xy = gpid / NB_PROCS_MAX;
+    unsigned int lpid       = gpid % NB_PROCS_MAX;
+    unsigned int x          = cluster_xy >> Y_WIDTH;
+    unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
+
     while(1)
     {
+        // initialize counter
         unsigned int count = GIET_IDLE_TASK_PERIOD;
 
@@ -119,13 +126,6 @@
 
         // warning message
-        unsigned int gpid       = _get_procid();
-        unsigned int cluster_xy = gpid / NB_PROCS_MAX;
-        unsigned int lpid       = gpid % NB_PROCS_MAX;
-        unsigned int x          = cluster_xy >> Y_WIDTH;
-        unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
-
         _printf("\n[GIET WARNING] Processor[%d,%d,%d] still idle at cycle %d\n",
                 x, y, lpid, _get_proctime() );
-
     }
 } // end ctx_idle()
Index: /soft/giet_vm/giet_kernel/ctx_handler.h
===================================================================
--- /soft/giet_vm/giet_kernel/ctx_handler.h	(revision 390)
+++ /soft/giet_vm/giet_kernel/ctx_handler.h	(revision 391)
@@ -70,12 +70,14 @@
     unsigned int wti_vector[32];       // software interrupt vector
     unsigned int reserved[30];         // padding to 4 Kbytes
+    unsigned int idle_stack[1024];     // private stack for idle stack (4Kbytes)
 } static_scheduler_t;
 
 
 /////////////////////////////////////////////////////////////////////////////////
-//  "idle" task index definition
+//  "idle" task index and stack size definition
 /////////////////////////////////////////////////////////////////////////////////
 
 #define IDLE_TASK_INDEX        13
+#define IDLE_TASK_STACK        0x1000
 
 /////////////////////////////////////////////////////////////////////////////////
@@ -107,5 +109,5 @@
 
 //////////////////////////////////////////////////////////////////////////////////
-//     Prototype of the context switch function
+//    context switch functions
 //////////////////////////////////////////////////////////////////////////////////
 
Index: /soft/giet_vm/giet_kernel/kernel_init.c
===================================================================
--- /soft/giet_vm/giet_kernel/kernel_init.c	(revision 390)
+++ /soft/giet_vm/giet_kernel/kernel_init.c	(revision 391)
@@ -14,6 +14,6 @@
 // and where there is one physical memory bank per cluster.
 //
-// The kernel_init() function is executed in parallel by all procesors, 
-// and completes the system initialisation that has been started by processor[0,0,0] 
+// The kernel_init() function is executed sequencially by all procesors. 
+// It completes the system initialisation that has been started by processor[0,0,0] 
 // in the boot_init() function. It makes the following assuptions, regarding the work 
 // bone by the boot code:
@@ -100,5 +100,9 @@
 
 #if !defined(IDLE_TASK_INDEX) 
-# error: You must define IDLE_TASK_INDEX in the giet_config.h file
+# error: You must define IDLE_TASK_INDEX in the ctx_handler.h file
+#endif
+
+#if !defined(IDLE_TASK_STACK) 
+# error: You must define IDLE_TASK_STACK in the ctx_handler.h file
 #endif
 
@@ -129,12 +133,5 @@
 
 ////////////////////////////////////////////////////////////////////////////////////
-// stacks for the "idle" tasks (64 bytes for each processor)
-////////////////////////////////////////////////////////////////////////////////////
-
-__attribute__((section (".kdata"))) 
-volatile unsigned int _idle_stack[X_SIZE * Y_SIZE * NB_PROCS_MAX * 16 ]; 
-
-////////////////////////////////////////////////////////////////////////////////////
-// Synchonisation Barrier before jumping to user code
+// Synchonisation barrier before jumping to user code
 ////////////////////////////////////////////////////////////////////////////////////
 
@@ -155,5 +152,5 @@
     while( pid != _init_barrier ) asm volatile ( "nop" );
 
-    // Step 1 : each processor get its scheduler virtual address
+    // Step 1 : each processor get its scheduler virtual address from CP0 register
     //          and contribute to initialise the _schedulers[] array
 
@@ -290,20 +287,20 @@
 
     // step 6 : each processor updates the idle_task context:
-    //          (only CTX_SP, CTX_RA, CTX_EPC).
-    //          The stack size is 512 bytes, reserved in seg_kdata.
+    //          (CTX_SP, CTX_RA, CTX_EPC).
+    //          The 4 Kbytes idle stack is implemented in the scheduler.
     //          The PTPR register, the CTX_PTPR and CTX_PTAB slots 
     //          have been initialised in boot code.
 
-    unsigned int p = ((x * Y_SIZE) + y) * NB_PROCS_MAX + lpid; 
-
-    unsigned int stack = (unsigned int)_idle_stack + ((p + 1) * 64);
-
-    _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_SP_ID,  stack);
+    unsigned int pstack = ((unsigned int)psched) + 0x2000;
+
+    _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_SP_ID,  pstack);
     _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_RA_ID,  (unsigned int) &_ctx_eret);
     _set_task_slot( global_pid, IDLE_TASK_INDEX, CTX_EPC_ID, (unsigned int) &_idle_task);
 
 #if GIET_DEBUG_INIT
-_printf("\n[GIET DEBUG INIT] Processor[%d,%d,%d] initializes IDLE task\n",
-        x, y, lpid );
+_printf("\n[GIET DEBUG INIT] Processor[%d,%d,%d] initializes IDLE task\n"
+        " - stack_base = %x\n"
+        " - stack_size = 0x1000\n",
+        x, y, lpid, pstack - 0x1000 );
 #endif
 
@@ -341,4 +338,14 @@
     // busy waiting until all processors synchronized
     while ( _init_barrier != NB_TOTAL_PROCS );
+
+#if GIET_DEBUG_INIT
+_printf("\n[GIET DEBUG INIT] Processor[%d,%d,%d] initializes registers at cycle %d\n"
+        " - sp   = %x\n"
+        " - sr   = %x\n"
+        " - ptpr = %x\n"
+        " - epc  = %x\n",
+        x, y, lpid, _get_proctime(),
+        sp_value, sr_value, ptpr_value, epc_value );
+#endif
 
     // set registers and jump to user code
