Index: soft/giet_vm/giet_libs/stdio.h
===================================================================
--- soft/giet_vm/giet_libs/stdio.h	(revision 689)
+++ soft/giet_vm/giet_libs/stdio.h	(revision 709)
@@ -14,4 +14,5 @@
 
 #include "giet_fat32/fat32_shared.h"
+#include "giet_common/mips32_registers.h"
 
 // These define must be synchronised with 
@@ -20,12 +21,12 @@
 #define SYSCALL_PROC_XYP             0x00
 #define SYSCALL_PROC_TIME            0x01
-#define SYSCALL_TTY_WRITE            0x02
-#define SYSCALL_TTY_READ             0x03
-#define SYSCALL_TTY_ALLOC            0x04
-#define SYSCALL_TASKS_STATUS         0x05
+#define SYSCALL_PROCS_NUMBER         0x02
+#define SYSCALL_GET_XY               0x03
+//                                   0x04
+//                                   0x05
 //                                   0x06
 #define SYSCALL_HEAP_INFO            0x07
-#define SYSCALL_LOCAL_TASK_ID        0x08
-#define SYSCALL_GLOBAL_TASK_ID       0x09
+#define SYSCALL_VOBJ_GET_VBASE       0x08
+#define SYSCALL_VOBJ_GET_LENGTH      0x09
 #define SYSCALL_FBF_CMA_ALLOC        0x0A
 #define SYSCALL_FBF_CMA_INIT_BUF     0x0B
@@ -33,10 +34,10 @@
 #define SYSCALL_FBF_CMA_DISPLAY      0x0D
 #define SYSCALL_FBF_CMA_STOP         0x0E
-#define SYSCALL_EXIT                 0x0F
-
-#define SYSCALL_PROCS_NUMBER         0x10
+//                                   0x0F
+
+#define SYSCALL_APPS_STATUS          0x10
 #define SYSCALL_FBF_SYNC_WRITE       0x11
 #define SYSCALL_FBF_SYNC_READ        0x12
-#define SYSCALL_THREAD_ID            0x13
+//                                   0x13
 #define SYSCALL_TIM_ALLOC            0x14
 #define SYSCALL_TIM_START            0x15
@@ -44,11 +45,11 @@
 #define SYSCALL_KILL_APP             0x17
 #define SYSCALL_EXEC_APP             0x18
-#define SYSCALL_CTX_SWITCH           0x19
-#define SYSCALL_VOBJ_GET_VBASE       0x1A
-#define SYSCALL_VOBJ_GET_LENGTH      0x1B
-#define SYSCALL_GET_XY               0x1C
-//                                   0x1D
-//                                   0x1E
-//                                   0x1F
+//                                   0x19
+#define SYSCALL_PTHREAD_CONTROL      0x1A
+#define SYSCALL_PTHREAD_YIELD        0x1B
+#define SYSCALL_PTHREAD_KILL         0x1C
+#define SYSCALL_PTHREAD_CREATE       0x1D
+#define SYSCALL_PTHREAD_JOIN         0x1E
+#define SYSCALL_PTHREAD_EXIT         0x1F
 
 #define SYSCALL_FAT_OPEN             0x20
@@ -75,7 +76,7 @@
 #define SYSCALL_NIC_STATS            0x34
 #define SYSCALL_NIC_CLEAR            0x35
-//                                   0x36
-//                                   0x37
-//                                   0x38
+#define SYSCALL_TTY_WRITE            0x36
+#define SYSCALL_TTY_READ             0x37
+#define SYSCALL_TTY_ALLOC            0x38
 //                                   0x39
 //                                   0x3A
@@ -152,21 +153,37 @@
 
 //////////////////////////////////////////////////////////////////////////
-//              Task related system calls
-//////////////////////////////////////////////////////////////////////////
-
-extern unsigned int giet_proc_task_id();
-
-extern unsigned int giet_global_task_id(); 
-
-extern unsigned int giet_thread_id(); 
-
-extern void giet_exit( char* string );
-
-extern void giet_assert( unsigned int condition, 
-                         char*        string );
-
-extern void giet_context_switch();
-
-extern void giet_tasks_status();
+//              Threads related system calls
+//////////////////////////////////////////////////////////////////////////
+
+typedef unsigned int pthread_t;
+
+typedef unsigned int pthread_attr_t;
+
+extern int giet_pthread_create( pthread_t*       trdid,
+                                pthread_attr_t*  attr,
+                                void*            function,
+                                void*            ptr ); 
+
+extern void giet_pthread_exit( void* string );
+
+extern int giet_pthread_join( pthread_t  trdid,
+                              void**     ptr );
+
+extern int giet_pthread_kill( pthread_t thread_id,
+                              int       signal );
+
+extern void giet_pthread_yield();
+
+extern void giet_pthread_assert( unsigned int condition, 
+                                 char*        string );
+
+extern int giet_pthread_pause( char*      vspace,
+                               char*      thread );
+
+extern int giet_pthread_resume( char*      vspace,
+                                char*      thread );
+
+extern int giet_pthread_context( char*      vspace,
+                                 char*      thread );
 
 //////////////////////////////////////////////////////////////////////////
@@ -177,4 +194,6 @@
 
 extern int giet_exec_application( char* name );
+
+extern void giet_applications_status();
 
 //////////////////////////////////////////////////////////////////////////
@@ -258,27 +277,27 @@
 //////////////////////////////////////////////////////////////////////////
 
-extern unsigned int giet_nic_rx_alloc( unsigned int xmax, unsigned int ymax );
-
-extern unsigned int giet_nic_tx_alloc( unsigned int xmax, unsigned int ymax );
-
-extern void giet_nic_rx_start( unsigned int channel );
-
-extern void giet_nic_tx_start( unsigned int channel );
-
-extern void giet_nic_rx_move( unsigned int channel, void* buffer );
-
-extern void giet_nic_tx_move( unsigned int channel, void* buffer );
-
-extern void giet_nic_rx_stop( unsigned int channel );
-
-extern void giet_nic_tx_stop( unsigned int channel );
-
-extern void giet_nic_rx_stats( unsigned int channel );
-
-extern void giet_nic_tx_stats( unsigned int channel );
-
-extern void giet_nic_rx_clear( unsigned int channel );
-
-extern void giet_nic_tx_clear( unsigned int channel );
+extern void giet_nic_rx_alloc( unsigned int xmax, unsigned int ymax );
+
+extern void giet_nic_tx_alloc( unsigned int xmax, unsigned int ymax );
+
+extern void giet_nic_rx_start();
+
+extern void giet_nic_tx_start();
+
+extern void giet_nic_rx_move( void* buffer );
+
+extern void giet_nic_tx_move( void* buffer );
+
+extern void giet_nic_rx_stop();
+
+extern void giet_nic_tx_stop();
+
+extern void giet_nic_rx_stats();
+
+extern void giet_nic_tx_stats();
+
+extern void giet_nic_rx_clear();
+
+extern void giet_nic_tx_clear();
 
 //////////////////////////////////////////////////////////////////////////
