Index: trunk/kernel/libk/rwlock.c
===================================================================
--- trunk/kernel/libk/rwlock.c	(revision 629)
+++ trunk/kernel/libk/rwlock.c	(revision 666)
@@ -52,8 +52,10 @@
 #if DEBUG_RWLOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-if( (type           == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
-printk("\n[%s] thread[%x,%x] initialise lock %s [%x,%x]\n",
+bool_t     cond = (lock_type == DEBUG_RWLOCK_TYPE) &&
+                  (((local_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                    (lock == (rwlock_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,
 lock_type_str[type], local_cxy, lock );
@@ -74,5 +76,10 @@
 
 #if DEBUG_RWLOCK_TYPE
-uint32_t lock_type = lock->lock.type;
+uint32_t   lock_type = lock->lock.type;
+bool_t     cond = (lock_type == DEBUG_RWLOCK_TYPE) &&
+                  (((local_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                    (lock == (rwlock_t*)DEBUG_RWLOCK_PTR)) ||
+                   ((DEBUG_RWLOCK_CXY == 0) &&
+                    (DEBUG_RWLOCK_PTR == 0)));
 #endif
 
@@ -82,7 +89,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond ) 
 printk("\n[%s] thread[%x,%x] READ BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
@@ -109,7 +114,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond )
 printk("\n[%s] thread[%x,%x] READ ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
@@ -134,5 +137,10 @@
 
 #if DEBUG_RWLOCK_TYPE
-uint32_t lock_type = lock->lock.type;
+uint32_t   lock_type = lock->lock.type;
+bool_t     cond = (lock_type == DEBUG_RWLOCK_TYPE) &&
+                  (((local_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                    (lock == (rwlock_t*)DEBUG_RWLOCK_PTR)) ||
+                   ((DEBUG_RWLOCK_CXY == 0) &&
+                    (DEBUG_RWLOCK_PTR == 0)));
 #endif
 
@@ -142,7 +150,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond )
 printk("\n[%s] thread[%x,%x] WRITE BLOCK on rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
@@ -169,7 +175,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond )
 printk("\n[%s] thread[%x,%x] WRITE ACQUIRE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
@@ -196,8 +200,14 @@
 #if DEBUG_RWLOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-uint32_t lock_type = lock->lock.type;
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+uint32_t   lock_type = lock->lock.type;
+bool_t     cond = (lock_type == DEBUG_RWLOCK_TYPE) &&
+                  (((local_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                    (lock == (rwlock_t*)DEBUG_RWLOCK_PTR)) ||
+                   ((DEBUG_RWLOCK_CXY == 0) &&
+                    (DEBUG_RWLOCK_PTR == 0)));
+#endif
+
+#if DEBUG_RWLOCK_TYPE
+if( cond )
 printk("\n[%s] thread[%x,%x] READ RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
@@ -213,7 +223,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
@@ -237,7 +245,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
@@ -272,8 +278,14 @@
 #if DEBUG_RWLOCK_TYPE
 thread_t * this = CURRENT_THREAD;
-uint32_t lock_type = lock->lock.type;
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+uint32_t   lock_type = lock->lock.type;
+bool_t     cond = (lock_type == DEBUG_RWLOCK_TYPE) &&
+                  (((local_cxy == (cxt_t)DEBUG_RWLOCK_CXY) &&
+                    (lock == (rwlock_t*)DEBUG_RWLOCK_PTR)) ||
+                   ((DEBUG_RWLOCK_CXY == 0) &&
+                    (DEBUG_RWLOCK_PTR == 0)));
+#endif
+
+#if DEBUG_RWLOCK_TYPE
+if( cond )
 printk("\n[%s] thread[%x,%x] WRITE RELEASE rwlock %s [%x,%x] / taken %d / count %d\n",
 __FUNCTION__, this->process->pid, this->trdid, 
@@ -288,7 +300,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
@@ -311,7 +321,5 @@
 
 #if DEBUG_RWLOCK_TYPE
-if( (lock_type      == DEBUG_RWLOCK_TYPE) &&
-    ((intptr_t)lock == DEBUG_RWLOCK_PTR ) &&
-    (local_cxy      == DEBUG_RWLOCK_CXY ) )
+if( cond )
 printk("\n[%s] thread[%x,%x] UNBLOCK thread[%x,%x] / rwlock %s [%x,%x]\n",
 __FUNCTION__, this->process->pid, this->trdid, thread->process->pid, thread->trdid,
