Index: trunk/kernel/libk/remote_rwlock.c
===================================================================
--- trunk/kernel/libk/remote_rwlock.c	(revision 629)
+++ trunk/kernel/libk/remote_rwlock.c	(revision 666)
@@ -55,7 +55,10 @@
 #if DEBUG_RWLOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-if( (type               == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
+bool_t     cond = (type == DEBUG_RWLOCK_TYPE) &&
+                  (((lock_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                    (lock_ptr == (remote_queuelock_t*)DEBUG_RWLOCK_PTR)) ||
+                   ((DEBUG_RWLOCK_CXY == 0) &&
+                    (DEBUG_RWLOCK_PTR == 0)));
+if( cond )
 printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid,
@@ -78,5 +81,11 @@
 
 #if DEBUG_RWLOCK_TYPE
-uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+uint32_t lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+bool_t   cond        = (type == DEBUG_RWLOCK_TYPE) &&
+                       (((lock_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                         (lock_ptr == (remote_queuelock_t*)DEBUG_RWLOCK_PTR)) ||
+                        ((DEBUG_RWLOCK_CXY == 0) &&
+                         (DEBUG_RWLOCK_PTR == 0)));
+xptr_t   wr_root_xp  = XPTR( lock_cxy , &lock_ptr->wr_xroot );
 #endif
 
@@ -95,11 +104,11 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
+if( cond )
+printk("\n[%s] thread[%x,%x] READ BLOCK on %s [%x,%x]\n"
+"     taken %d / count %d / wr_empty %d / rd_empty %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
 lock_type_str[lock_type], lock_cxy, lock_ptr,
-hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ) );
+hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ),
+xlist_is_empty( wr_root_xp ), xlist_is_empty( rd_root_xp ) );
 #endif
         // get pointer on calling thread
@@ -128,11 +137,11 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
+if( cond )
+printk("\n[%s] thread[%x,%x] READ ACQUIRE %s [%x,%x]\n"
+"     taken %d / count %d / wr_empty %d / rd_empty %d\n",
 __FUNCTION__, this->process->pid, this->trdid,
 lock_type_str[lock_type], lock_cxy, lock_ptr,
-hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ) );
+hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ),
+xlist_is_empty( wr_root_xp ), xlist_is_empty( rd_root_xp ) );
 #endif
 
@@ -155,5 +164,11 @@
 
 #if DEBUG_RWLOCK_TYPE
-uint32_t lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+uint32_t lock_type   = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+bool_t   cond        = (type == DEBUG_RWLOCK_TYPE) &&
+                       (((lock_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                         (lock_ptr == (remote_queuelock_t*)DEBUG_RWLOCK_PTR)) ||
+                        ((DEBUG_RWLOCK_CXY == 0) &&
+                         (DEBUG_RWLOCK_PTR == 0)));
+xptr_t   rd_root_xp  = XPTR( lock_cxy , &lock_ptr->rd_xroot );
 #endif
 
@@ -172,11 +187,11 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
+if( cond )
+printk("\n[%s] thread[%x,%x] WRITE BLOCK on %s [%x,%x]\n"
+"     taken %d / count %d / wr_empty %d / rd_empty %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
 lock_type_str[lock_type], lock_cxy, lock_ptr, 
-hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ) );
+hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ),
+xlist_is_empty( wr_root_xp ), xlist_is_empty( rd_root_xp ) );
 #endif
 
@@ -204,11 +219,11 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
+if( cond )
+printk("\n[%s] thread[%x,%x] WRITE ACQUIRE %s [%x,%x]\n"
+"     taken %d / count %d / wr_empty %d / rd_empty %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
 lock_type_str[lock_type], lock_cxy, lock_ptr,
-hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ) );
+hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ),
+xlist_is_empty( wr_root_xp ), xlist_is_empty( rd_root_xp ) );
 #endif
 
@@ -244,12 +259,20 @@
 thread_t * this      = CURRENT_THREAD;
 uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+bool_t     cond      = (type == DEBUG_RWLOCK_TYPE) &&
+                       (((lock_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                         (lock_ptr == (remote_queuelock_t*)DEBUG_RWLOCK_PTR)) ||
+                        ((DEBUG_RWLOCK_CXY == 0) &&
+                         (DEBUG_RWLOCK_PTR == 0)));
 xptr_t     taken_xp  = XPTR( lock_cxy , &lock_ptr->taken );
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
+#endif
+
+#if DEBUG_RWLOCK_TYPE
+if( cond )
+printk("\n[%s] thread[%x,%x] READ RELEASE %s [%x,%x]\n"
+"     taken %d / count %d / wr_empty %d / rd_empty %d\n",
 __FUNCTION__, this->process->pid, this->trdid,
 lock_type_str[lock_type], lock_cxy, lock_ptr,
-hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ) );
+hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ),
+xlist_is_empty( wr_root_xp ), xlist_is_empty( rd_root_xp ) );
 #endif
 
@@ -270,7 +293,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
+if( cond )
 {
     trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
@@ -303,7 +324,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
+if( cond )
 {
     trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
@@ -349,12 +368,20 @@
 thread_t * this      = CURRENT_THREAD;
 uint32_t   lock_type = hal_remote_l32( XPTR( lock_cxy , &lock_ptr->lock.type ) );
+bool_t     cond      = (type == DEBUG_RWLOCK_TYPE) &&
+                       (((lock_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                         (lock_ptr == (remote_queuelock_t*)DEBUG_RWLOCK_PTR)) ||
+                        ((DEBUG_RWLOCK_CXY == 0) &&
+                         (DEBUG_RWLOCK_PTR == 0)));
 xptr_t     count_xp  = XPTR( lock_cxy , &lock_ptr->count );
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
+#endif
+
+#if DEBUG_RWLOCK_TYPE
+if( cond )
+printk("\n[%s] thread[%x,%x] WRITE RELEASE %s [%x,%x]\n"
+"     taken %d / count %d / wr_empty %d / rd_empty %d\n",
 __FUNCTION__, this->process->pid, this->trdid,
 lock_type_str[lock_type], lock_cxy, lock_ptr,
-hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ) );
+hal_remote_l32( taken_xp ), hal_remote_l32( count_xp ),
+xlist_is_empty( wr_root_xp ), xlist_is_empty( rd_root_xp ) );
 #endif
 
@@ -374,7 +401,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
+if( cond )
 {
     trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
@@ -406,7 +431,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type          == DEBUG_RWLOCK_TYPE) && 
-    ((intptr_t)lock_ptr == DEBUG_RWLOCK_PTR ) && 
-    (lock_cxy           == DEBUG_RWLOCK_CXY ) )
+if( cond )
 {
     trdid_t     trdid     = hal_remote_l32( XPTR( thread_cxy , &thread_ptr->trdid ) );
