Index: trunk/kernel/syscalls/sys_sem.c
===================================================================
--- trunk/kernel/syscalls/sys_sem.c	(revision 23)
+++ trunk/kernel/syscalls/sys_sem.c	(revision 440)
@@ -2,5 +2,5 @@
  * sys_sem.c - Acces a POSIX unamed semaphore.
  * 
- * Authors     Alain Greiner (2016,2017)
+ * Authors     Alain Greiner (2016,2017,2018)
  *
  * Copyright (c) UPMC Sorbonne Universites
@@ -36,30 +36,39 @@
              uint32_t     * value )       // pointer on in/out argument
 {
-	uint32_t             data;   
-	paddr_t              paddr;
-    error_t              error;
+	uint32_t         data;   
+	vseg_t         * vseg;
+    error_t          error;
 
-    thread_t           * this = CURRENT_THREAD;
+    thread_t       * this    = CURRENT_THREAD;
+    process_t      * process = this->process;
 
     // check vaddr in user vspace
-	error = vmm_v2p_translate( false , vaddr , &paddr );
+	error = vmm_get_vseg( process , (intptr_t)vaddr , &vseg );
 	if( error )
     {
-        printk("\n[ERROR] in %s : illegal semaphore virtual address = %x\n",
-               __FUNCTION__ , (intptr_t)vaddr );
-        this->errno = error;
+
+#if DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : unmapped semaphore %x / thread %x / process %x\n",
+__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
+vmm_display( process , false );
+#endif
+        this->errno = EINVAL;
         return -1;
     }
 
     // check value in user vspace
-	error = vmm_v2p_translate( false , value , &paddr );
+	error = vmm_get_vseg( process , (intptr_t)value , &vseg );
 	if( error )
     {
-        printk("\n[ERROR] in %s : illegal argument virtual address = %x\n",
-               __FUNCTION__ , (intptr_t)value );
-        this->errno = error;
-        return -1;   
+
+#if DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : unmapped value %x / thread %x / process %x\n",
+__FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid );
+vmm_display( process , false );
+#endif
+        this->errno = EINVAL;
+        return -1;
     }
-    
+
     // execute requested operation
 	switch( operation )
@@ -91,6 +100,9 @@
             if( sem_xp == XPTR_NULL )     // user error
             {
-                printk("\n[ERROR] in %s : semaphore %x not registered\n",
-                       __FUNCTION__ , (intptr_t)value );
+
+#if DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n",
+__FUNCTION__ , (intptr_t)value, this->trdid, process->pid );
+#endif
                 this->errno = EINVAL;
                 return -1;
@@ -114,6 +126,9 @@
             if( sem_xp == XPTR_NULL )     // user error
             {
-                printk("\n[ERROR] in %s : semaphore %x not registered\n",
-                       __FUNCTION__ , (intptr_t)value );
+
+#if DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n",
+__FUNCTION__ , (intptr_t)value, this->trdid, process->pid );
+#endif
                 this->errno = EINVAL;
                 return -1;
@@ -134,6 +149,9 @@
             if( sem_xp == XPTR_NULL )     // user error
             {
-                printk("\n[ERROR] in %s : semaphore %x not registered\n",
-                       __FUNCTION__ , (intptr_t)value );
+
+#if DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n",
+__FUNCTION__ , (intptr_t)value, this->trdid, process->pid );
+#endif
                 this->errno = EINVAL;
                 return -1;
@@ -154,6 +172,9 @@
             if( sem_xp == XPTR_NULL )     // user error
             {
-                printk("\n[ERROR] in %s : semaphore %x not registered\n",
-                       __FUNCTION__ , (intptr_t)value );
+
+#if DEBUG_SYSCALLS_ERROR
+printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n",
+__FUNCTION__ , (intptr_t)value, this->trdid, process->pid );
+#endif
                 this->errno = EINVAL;
                 return -1;
