Index: trunk/kernel/kern/kernel_init.c
===================================================================
--- trunk/kernel/kern/kernel_init.c	(revision 436)
+++ trunk/kernel/kern/kernel_init.c	(revision 437)
@@ -324,6 +324,6 @@
             }
 
-#if( CONFIG_KINIT_DEBUG & 0x1 )
-if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
+#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
+if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
 printk("\n[DBG] %s : created MMC in cluster %x / chdev = %x\n",
 __FUNCTION__ , local_cxy , chdev_ptr );
@@ -353,6 +353,6 @@
                 chdev_dir.dma[channel] = XPTR( local_cxy , chdev_ptr );
 
-#if( CONFIG_KINIT_DEBUG & 0x1 )
-if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
+#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
+if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
 printk("\n[DBG] %s : created DMA[%d] in cluster %x / chdev = %x\n",
 __FUNCTION__ , channel , local_cxy , chdev_ptr );
@@ -488,6 +488,6 @@
                     }
 
-#if( CONFIG_KINIT_DEBUG & 0x1 )
-if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
+#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
+if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
 printk("\n[DBG] %s : create chdev %s / channel = %d / rx = %d / cluster %x / chdev = %x\n",
 __FUNCTION__ , chdev_func_str( func ), channel , rx , local_cxy , chdev );
@@ -623,6 +623,6 @@
     } 
 
-#if( CONFIG_KINIT_DEBUG & 0x1 )
-if( hal_time_stamp() > CONFIG_KINIT_DEBUG )
+#if( CONFIG_DEBUG_KERNEL_INIT & 0x1 )
+if( hal_time_stamp() > CONFIG_DEBUG_KERNEL_INIT )
 {
     printk("\n[DBG] %s created PIC chdev in cluster %x at cycle %d\n",
@@ -792,8 +792,9 @@
     thread->core = &LOCAL_CLUSTER->core_tbl[core_lid];
 
-#if CONFIG_LOCKS_DEBUG
+    // each core initializes the idle thread lists of locks
     list_root_init( &thread->locks_root );
     xlist_root_init( XPTR( local_cxy , &thread->xlocks_root ) );
-#endif
+    thread->local_locks = 0;
+    thread->remote_locks = 0;
 
     // CP0 in I/O cluster initialises TXT0 chdev descriptor
@@ -804,8 +805,11 @@
                                         (info->x_size * info->y_size) );
     barrier_wait( &local_barrier , info->cores_nr );
-
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 0 : TXT0 initialized / cycle %d\n",
-    __FUNCTION__, hal_time_stamp() );
+    /////////////////////////////////////////////////////////////////////////////////
+
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == 0) ) 
+printk("\n[DBG] %s : exit barrier 0 : TXT0 initialized / cycle %d\n",
+__FUNCTION__, (uint32_t)hal_get_cycles() );
+#endif
 
     /////////////////////////////////////////////////////////////////////////////
@@ -841,7 +845,9 @@
     /////////////////////////////////////////////////////////////////////////////////
 
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 1 : clusters initialised / cycle %d\n",
-    __FUNCTION__, hal_time_stamp() );
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == 0) ) 
+printk("\n[DBG] %s : exit barrier 1 : clusters initialised / cycle %d\n",
+__FUNCTION__, (uint32_t)hal_get_cycles() );
+#endif
 
     /////////////////////////////////////////////////////////////////////////////////
@@ -866,7 +872,9 @@
     ////////////////////////////////////////////////////////////////////////////////
 
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 2 : PIC initialised / cycle %d\n",
-    __FUNCTION__, hal_time_stamp() );
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == 0) ) 
+printk("\n[DBG] %s : exit barrier 2 : PIC initialised / cycle %d\n",
+__FUNCTION__, (uint32_t)hal_get_cycles() );
+#endif
 
     ////////////////////////////////////////////////////////////////////////////////
@@ -897,8 +905,14 @@
     /////////////////////////////////////////////////////////////////////////////////
 
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 3 : all chdev initialised / cycle %d\n",
-               __FUNCTION__, hal_time_stamp());
-
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == 0) ) 
+printk("\n[DBG] %s : exit barrier 3 : all chdev initialised / cycle %d\n",
+__FUNCTION__, (uint32_t)hal_get_cycles() );
+#endif
+
+#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
+chdev_dir_display();
+#endif
+    
     /////////////////////////////////////////////////////////////////////////////////
     // STEP 4 : All cores enable IPI (Inter Procesor Interrupt),
@@ -908,8 +922,4 @@
     /////////////////////////////////////////////////////////////////////////////////
 
-#if CONFIG_KINIT_DEBUG 
-chdev_dir_display();
-#endif
-    
     // All cores enable the shared IPI channel
     dev_pic_enable_ipi();
@@ -932,5 +942,5 @@
     core->scheduler.idle = thread;
 
-#if CONFIG_KINIT_DEBUG
+#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
 sched_display( core_lid );
 #endif
@@ -1004,7 +1014,9 @@
     /////////////////////////////////////////////////////////////////////////////////
 
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 4 : VFS_root = %l in cluster 0 / cycle %d\n",
-               __FUNCTION__, vfs_root_inode_xp , hal_time_stamp());
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == 0) ) 
+printk("\n[DBG] %s : exit barrier 4 : VFS_root = %l in cluster 0 / cycle %d\n",
+__FUNCTION__, vfs_root_inode_xp , (uint32_t)hal_get_cycles());
+#endif
 
     /////////////////////////////////////////////////////////////////////////////////
@@ -1063,7 +1075,9 @@
     /////////////////////////////////////////////////////////////////////////////////
 
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 5 : VFS_root = %l in cluster IO / cycle %d\n",
-    __FUNCTION__, vfs_root_inode_xp , hal_time_stamp() );
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == io_cxy) ) 
+printk("\n[DBG] %s : exit barrier 5 : VFS_root = %l in cluster %x / cycle %d\n",
+__FUNCTION__, vfs_root_inode_xp , io_cxy , (uint32_t)hal_get_cycles());
+#endif
 
     /////////////////////////////////////////////////////////////////////////////////
@@ -1096,7 +1110,9 @@
     /////////////////////////////////////////////////////////////////////////////////
 
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 6 : dev_root = %l in cluster IO / cycle %d\n",
-    __FUNCTION__, devfs_dev_inode_xp , hal_time_stamp() );
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == io_cxy) )
+printk("\n[DBG] %s : exit barrier 6 : dev_root = %l in cluster %x / cycle %d\n",
+__FUNCTION__, devfs_dev_inode_xp , io_cxy , (uint32_t)hal_get_cycles() );
+#endif
 
     /////////////////////////////////////////////////////////////////////////////////
@@ -1133,16 +1149,18 @@
     /////////////////////////////////////////////////////////////////////////////////
 
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == 0) ) 
+printk("\n[DBG] %s : exit barrier 7 : dev_root = %l in cluster 0 / cycle %d\n",
+__FUNCTION__, devfs_dev_inode_xp , (uint32_t)hal_get_cycles() );
+#endif
+
+    /////////////////////////////////////////////////////////////////////////////////
+    // STEP 8 : CP0 in cluster 0 creates the first user process (process_init)
+    /////////////////////////////////////////////////////////////////////////////////
+
     if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 7 : dev_root = %l in cluster 0 / cycle %d\n",
-    __FUNCTION__, devfs_dev_inode_xp , hal_time_stamp() );
-
-    /////////////////////////////////////////////////////////////////////////////////
-    // STEP 8 : CP0 in cluster 0 creates the first user process (process_init)
-    /////////////////////////////////////////////////////////////////////////////////
-
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    {
-
-#if CONFIG_KINIT_DEBUG
+    {
+
+#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
 vfs_display( vfs_root_inode_xp );
 #endif
@@ -1157,7 +1175,9 @@
     /////////////////////////////////////////////////////////////////////////////////
 
-    if( (core_lid ==  0) && (local_cxy == 0) ) 
-    kinit_dmsg("\n[DBG] %s : exit barrier 8 : process init created / cycle %d\n", 
-    __FUNCTION__ , hal_time_stamp() );
+#if CONFIG_DEBUG_KERNEL_INIT
+if( (core_lid ==  0) && (local_cxy == 0) ) 
+printk("\n[DBG] %s : exit barrier 8 : process init created / cycle %d\n", 
+__FUNCTION__ , (uint32_t)hal_get_cycles() );
+#endif
 
     /////////////////////////////////////////////////////////////////////////////////
@@ -1169,7 +1189,6 @@
         print_banner( (info->x_size * info->y_size) , info->cores_nr );
 
-#if CONFIG_KINIT_DEBUG
-
-        printk("\n\n***** memory fooprint for main kernel objects\n\n"
+#if( CONFIG_DEBUG_KERNEL_INIT & 1 )
+printk("\n\n***** memory fooprint for main kernel objects\n\n"
                    " - thread descriptor  : %d bytes\n"
                    " - process descriptor : %d bytes\n"
