Index: soft/giet_vm/giet_kernel/irq_handler.c
===================================================================
--- soft/giet_vm/giet_kernel/irq_handler.c	(revision 260)
+++ soft/giet_vm/giet_kernel/irq_handler.c	(revision 263)
@@ -29,5 +29,5 @@
 
 #if NB_TIM_CHANNELS
-extern volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIM_CHANNELS] ;
+extern volatile unsigned char _user_timer_event[X_SIZE*Y_SIZE*NB_TIM_CHANNELS] ;
 #endif
 
Index: soft/giet_vm/giet_kernel/kernel_init.c
===================================================================
--- soft/giet_vm/giet_kernel/kernel_init.c	(revision 260)
+++ soft/giet_vm/giet_kernel/kernel_init.c	(revision 263)
@@ -11,5 +11,5 @@
 // physicals addresses can have up to 40 bits, and use the  (unsigned long long) type.
 // It natively supports clusterised shared mmemory multi-processors architectures, 
-// where each processor is identified by a composite index (cluster_id, local_id),
+// where each processor is identified by a composite index (cluster_xy, local_id),
 // and where there is one physical memory bank per cluster.
 //
@@ -61,5 +61,5 @@
 
 __attribute__((section (".kdata"))) 
-static_scheduler_t* _schedulers[NB_CLUSTERS * NB_PROCS_MAX];   // virtual addresses
+static_scheduler_t* _schedulers[X_SIZE*Y_SIZE * NB_PROCS_MAX];   // virtual addresses
 
 ////////////////////////////////////////////////////////////////////////////////////
@@ -68,5 +68,5 @@
 
 __attribute__((section (".kdata"))) 
-unsigned int _idle_stack[NB_CLUSTERS * NB_PROCS_MAX * 128]; 
+unsigned int _idle_stack[X_SIZE*Y_SIZE * NB_PROCS_MAX * 128]; 
 
 ////////////////////////////////////////////////////////////////////////////////////
@@ -108,13 +108,19 @@
 {
     unsigned int global_pid = _get_procid();
+    unsigned int cluster_xy = global_pid / NB_PROCS_MAX;
+    unsigned int local_pid  = global_pid % NB_PROCS_MAX;
 
 #if 0
-// Debug feature : we can kill all processors but one
-if ( global_pid != 1 ) 
+////////////// Debug : we can kill all processors but one
+if ( global_pid != 0 ) 
 {
     _tty_get_lock( 0 );
-    _puts("\n[GIET] Processor ");
-    _putd( global_pid );
-    _puts(" suicide...\n");
+    _puts("\n[GIET] Processor[");
+    _putd( cluster_xy >> Y_WIDTH );
+    _puts(",");
+    _putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+    _puts(",");
+    _putd( local_pid );
+    _puts("] suicide...\n");
     _tty_release_lock( 0 );
     _exit();
@@ -125,6 +131,4 @@
     //          and contribute to initialise the _schedulers[] array
 
-    unsigned int        cluster_id = global_pid / NB_PROCS_MAX;
-    unsigned int        proc_id    = global_pid % NB_PROCS_MAX;
     static_scheduler_t* psched     = (static_scheduler_t*)_get_sched();
     unsigned int        tasks      = psched->tasks;
@@ -134,7 +138,11 @@
 #if GIET_DEBUG_INIT
 _tty_get_lock( 0 );
-_puts("\n[GIET DEBUG] Parallel init : step 1 for processor ");
-_putd(global_pid);
-_puts("\n - scheduler vbase = ");
+_puts("\n[GIET DEBUG] Parallel init : step 1 for processor[");
+_putd( cluster_xy >> Y_WIDTH );
+_puts(",");
+_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+_puts(",");
+_putd( local_pid );
+_puts("]\n - scheduler vbase = ");
 _putx((unsigned int) psched);
 _puts("\n - tasks           = ");
@@ -173,7 +181,11 @@
 #if GIET_DEBUG_INIT
 _tty_get_lock( 0 );
-_puts("\n[GIET DEBUG] Parallel init : step 2 for processor ");
-_putd( global_pid );
-_puts(" / task ");
+_puts("\n[GIET DEBUG] Parallel init : step 2 for processor[");
+_putd( cluster_xy >> Y_WIDTH );
+_puts(",");
+_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+_puts(",");
+_putd( local_pid );
+_puts("] / task ");
 _putd( ltid );
 _puts("\n - ctx_vsid  = ");
@@ -202,5 +214,5 @@
     //          there is at most 32 interrupts per processor
 
-    unsigned int isr_switch_channel = 0xFFFFFFFF;
+    unsigned int isr_switch_index = 0xFFFFFFFF;
     unsigned int irq_id;            // IN_IRQ index
     unsigned int hwi_mask = 0;
@@ -228,12 +240,16 @@
             _exit();
         }
-        if (isr == ISR_SWITCH) isr_switch_channel = irq_id;
+        if (isr == ISR_SWITCH) isr_switch_index = irq_id;
     }
 
 #if GIET_DEBUG_INIT
 _tty_get_lock( 0 );
-_puts("\n[GIET DEBUG] Parallel init : step 3 for processor ");
-_putd(global_pid);
-_puts("\n - ICU HWI_MASK = ");
+_puts("\n[GIET DEBUG] Parallel init : step 3 for processor[");
+_putd( cluster_xy >> Y_WIDTH );
+_puts(",");
+_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+_puts(",");
+_putd( local_pid );
+_puts("]\n - ICU HWI_MASK = ");
 _putx(hwi_mask);
 _puts("\n - ICU SWI_MASK = ");
@@ -253,9 +269,9 @@
 
 #if USE_XICU
-    _xcu_set_mask(cluster_id, proc_id, hwi_mask, IRQ_TYPE_HWI); // set HWI_MASK
-    _xcu_set_mask(cluster_id, proc_id, swi_mask, IRQ_TYPE_SWI); // set SWI_MASK
-    _xcu_set_mask(cluster_id, proc_id, pti_mask, IRQ_TYPE_PTI); // set PTI_MASK
+    _xcu_set_mask(cluster_xy, local_pid, hwi_mask, IRQ_TYPE_HWI); // set HWI_MASK
+    _xcu_set_mask(cluster_xy, local_pid, swi_mask, IRQ_TYPE_SWI); // set SWI_MASK
+    _xcu_set_mask(cluster_xy, local_pid, pti_mask, IRQ_TYPE_PTI); // set PTI_MASK
 #else
-    _icu_set_mask(cluster_id, proc_id, (hwi_mask | pti_mask | swi_mask) );   
+    _icu_set_mask(cluster_xy, local_pid, (hwi_mask | pti_mask | swi_mask) );   
 #endif
 
@@ -264,9 +280,9 @@
     {
         // one ISR_SWITCH must be defined for each proc
-        if (isr_switch_channel == 0xFFFFFFFF) 
+        if (isr_switch_index == 0xFFFFFFFF) 
         {
             _tty_get_lock( 0 );
-            _puts("\n[GIET ERROR] ISR_SWITCH not found on proc ");
-            _putd(proc_id);
+            _puts("\n[GIET ERROR] ISR_SWITCH not found for processor ");
+            _putx(global_pid);
             _puts("\n");
             _tty_release_lock( 0 );
@@ -277,13 +293,13 @@
         unsigned int ko;
 #if USE_XICU
-        ko = _xcu_timer_start( cluster_id, isr_switch_channel, GIET_TICK_VALUE ); 
+        ko = _xcu_timer_start( cluster_xy, local_pid, GIET_TICK_VALUE ); 
 #else
-        ko = _timer_start( cluster_id, isr_switch_channel, GIET_TICK_VALUE ); 
+        ko = _timer_start( cluster_xy, local_pid, GIET_TICK_VALUE ); 
 #endif
         if ( ko )
         {
             _tty_get_lock( 0 );
-            _puts("\n[GIET ERROR] ISR_SWITCH start error for processor ");
-            _putd(proc_id);
+            _puts("\n[GIET ERROR] cannot start timer for processor ");
+            _putd(local_pid);
             _puts("\n");
             _tty_release_lock( 0 );
@@ -294,6 +310,11 @@
 #if GIET_DEBUG_INIT
 _tty_get_lock( 0 );
-_puts("\n[GIET DEBUG] Parallel init : step 4 for processor ");
-_putd(global_pid);
+_puts("\n[GIET DEBUG] Parallel init : step 4 for processor[");
+_putd( cluster_xy >> Y_WIDTH );
+_puts(",");
+_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+_puts(",");
+_putd( local_pid );
+_puts("]");
 if ( tasks > 1 ) _puts("\n  context switch activated\n");
 else             _puts("\n  context switch  not activated\n");
@@ -315,7 +336,11 @@
 #if GIET_DEBUG_INIT
 _tty_get_lock( 0 );
-_puts("\n[GIET DEBUG] Parallel init : step 5 for processor ");
-_putd(global_pid);
-_puts("\n  idle task context set\n");
+_puts("\n[GIET DEBUG] Parallel init : step 5 for processor[");
+_putd( cluster_xy >> Y_WIDTH );
+_puts(",");
+_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+_puts(",");
+_putd( local_pid );
+_puts("] : idle task context set\n");
 _tty_release_lock( 0 );
 #endif
@@ -333,5 +358,5 @@
         _tty_get_lock( 0 );
         _puts("\n[GIET WARNING] No task allocated to processor ");
-        _putd(global_pid);
+        _putx(global_pid);
         _puts(" => idle\n");
         _tty_release_lock ( 0 );
@@ -345,7 +370,11 @@
 #if GIET_DEBUG_INIT
 _tty_get_lock( 0 );
-_puts("\n[GIET DEBUG] Parallel init : step 6 for processor ");
-_putd(global_pid);
-_puts("\n - sp   = ");
+_puts("\n[GIET DEBUG] Parallel init : step 6 for processor[");
+_putd( cluster_xy >> Y_WIDTH );
+_puts(",");
+_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+_puts(",");
+_putd( local_pid );
+_puts("]\n - sp   = ");
 _putx(sp_value);
 _puts("\n - sr   = ");
@@ -360,7 +389,11 @@
 
 _tty_get_lock( 0 );
-_puts("\n[GIET] Processor ");
-_putd( global_pid );
-_puts(" completes kernel init at cycle ");
+_puts("\n[GIET] Processor[");
+_putd( cluster_xy >> Y_WIDTH );
+_puts(",");
+_putd( cluster_xy & ((1<<Y_WIDTH)-1) );
+_puts(",");
+_putd( local_pid );
+_puts("] completes kernel init at cycle ");
 _putd( _get_proctime() );
 _puts(" / task_entry_point = ");
Index: soft/giet_vm/giet_kernel/switch.s
===================================================================
--- soft/giet_vm/giet_kernel/switch.s	(revision 260)
+++ soft/giet_vm/giet_kernel/switch.s	(revision 263)
@@ -2,4 +2,13 @@
 * This function receives two arguments that are the current task context 
 * (virtual) addresses and the next task context (virtual) address.
+*
+* TODO (AG) Il semble possible de limiter le nombre de registres Ã  sauver:
+* - s0 Ã  s8 ($16 Ã  $23 + $30)
+* - sp ($29)
+* - ra ($31)
+* - hi et lo
+* - sr
+* - epc
+* - ptpr
 ******************************************************************************/
 
Index: soft/giet_vm/giet_kernel/sys_handler.c
===================================================================
--- soft/giet_vm/giet_kernel/sys_handler.c	(revision 260)
+++ soft/giet_vm/giet_kernel/sys_handler.c	(revision 263)
@@ -153,9 +153,11 @@
     mapping_cluster_t * cluster = _get_cluster_base(header);
 
-    if (cluster_id < header->clusters) {
+    if ( cluster_id < X_SIZE * Y_SIZE ) 
+    {
         *buffer = cluster[cluster_id].procs;
         return 0;
     }
-    else {
+    else 
+    {
         return 1;
     }
