Index: trunk/hal/tsar_mips32/core/hal_remote.c
===================================================================
--- trunk/hal/tsar_mips32/core/hal_remote.c	(revision 95)
+++ trunk/hal/tsar_mips32/core/hal_remote.c	(revision 121)
@@ -29,6 +29,9 @@
                     uint8_t  data )
 {
-    uint32_t ptr = (uint32_t)GET_PTR( xp );
-    uint32_t cxy = (uint32_t)GET_CXY( xp );
+    uint32_t save_sr;
+    uint32_t ptr = (uint32_t)GET_PTR( xp );
+    uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -41,4 +44,7 @@
         ".set reorder                \n"
         : : "r" (data), "r" (ptr), "r" (cxy) : "$15" );
+
+    hal_restore_irq( save_sr );
+
 }
 
@@ -47,6 +53,9 @@
                     uint32_t  data )
 {
-    uint32_t ptr = (uint32_t)GET_PTR( xp );
-    uint32_t cxy = (uint32_t)GET_CXY( xp );
+    uint32_t save_sr;
+    uint32_t ptr = (uint32_t)GET_PTR( xp );
+    uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( "mfc2   $15,    $24          \n"  /* $15 <= PADDR_EXT */   
@@ -58,4 +67,7 @@
         ".set reorder                \n"
         : : "r" (data), "r" (ptr), "r" (cxy) : "$15" );
+
+    hal_restore_irq( save_sr );
+
 }
 
@@ -64,4 +76,5 @@
                      uint64_t  data )
 {
+    uint32_t save_sr;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
@@ -69,4 +82,6 @@
     uint32_t data_lsb = (uint32_t)data;
     uint32_t data_msb = (uint32_t)(data>>32);
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -80,4 +95,7 @@
         ".set reorder                \n"
         : : "r" (data_lsb), "r" (data_msb), "r" (ptr), "r" (cxy) : "$15" );
+
+    hal_restore_irq( save_sr );
+
 }
 
@@ -92,7 +110,10 @@
 uint8_t hal_remote_lb( xptr_t  xp )
 {
+    uint32_t save_sr;
 	char     data;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -105,4 +126,6 @@
         : "=r" (data) : "r" (ptr), "r" (cxy) : "$15" );
 
+    hal_restore_irq( save_sr );
+
 	return ( data );
 }
@@ -111,7 +134,10 @@
 uint32_t hal_remote_lw( xptr_t  xp )
 {
+    uint32_t save_sr;
 	uint32_t data;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -124,4 +150,6 @@
         : "=r" (data) : "r" (ptr), "r" (cxy) : "$15" );
 
+    hal_restore_irq( save_sr );
+
     return ( data );
 }
@@ -130,8 +158,11 @@
 uint64_t hal_remote_lwd( xptr_t  xp )
 {
+    uint32_t save_sr;
     uint32_t data_lsb;
     uint32_t data_msb;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -145,5 +176,8 @@
         : "=r" (data_lsb), "=r"(data_msb) : "r" (ptr), "r" (cxy) : "$15" );
 
+    hal_restore_irq( save_sr );
+
     return ( (((uint64_t)data_msb)<<32) + (((uint64_t)data_lsb)) );
+
 }
 
@@ -159,7 +193,10 @@
                               uint32_t  new )
 {
+    uint32_t save_sr;
 	bool_t   isAtomic;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -181,6 +218,9 @@
 		: "$3", "$7", "$8", "$15" );
 
+    hal_restore_irq( save_sr );
+
 	return isAtomic;
-}
+
+}  // end hal_remote_atomic_cas()
 
 ////////////////////////////////////////////
@@ -188,7 +228,10 @@
                                 uint32_t incr )
 {	
+    uint32_t save_sr;
 	uint32_t current;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -206,6 +249,9 @@
 		: "=&r" (current) : "r" (ptr), "r" (incr), "r" (cxy) : "$3", "$15" );
 
+    hal_restore_irq( save_sr );
+
 	return current;
-}
+
+}  // end hal_remote_atomic_add()
 
 ////////////////////////////////////////////
@@ -213,7 +259,10 @@
                                 uint32_t mask )
 {	
+    uint32_t save_sr;
 	uint32_t current;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -231,6 +280,9 @@
 	    : "=&r" (current) : "r" (ptr), "r" (mask), "r" (cxy) : "$3", "$15" );
 
+    hal_restore_irq( save_sr );
+
 	return current;
-}
+
+}  // end hal_remote_atomic_and()
 
 ////////////////////////////////////////////
@@ -238,7 +290,10 @@
                                uint32_t mask )
 {	
+    uint32_t save_sr;
 	uint32_t current;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -256,6 +311,9 @@
 	    : "=&r" (current) : "r" (ptr), "r" (mask), "r" (cxy) : "$3", "$15" );
 
+    hal_restore_irq( save_sr );
+
 	return current;
-}
+
+}  // end hal_remote_atomic_or()
 
 /////////////////////////////////////////////////
@@ -264,8 +322,11 @@
                                    uint32_t * old )
 {
+    uint32_t save_sr;
 	uint32_t current;
 	error_t  error;
     uint32_t ptr = (uint32_t)GET_PTR( xp );
     uint32_t cxy = (uint32_t)GET_CXY( xp );
+
+    hal_disable_irq( &save_sr );
 
     asm volatile( 
@@ -277,6 +338,6 @@
         "sc     $3,     (%2)         \n"  /* *paddr <= $3         */
         "beq    $3,     $0,     1f   \n"  /* exit if failure      */
-        "ori    %1,     $0,      1   \n"	/* fail: ret <= 1       */
-        "and    %1,     $0,     $0   \n"	/* success: ret <= 0    */
+        "ori    %1,     $0,      1   \n"  /* fail: ret <= 1       */
+        "and    %1,     $0,     $0   \n"  /* success: ret <= 0    */
         "1:                          \n"
         "mtc2   $15,    $24          \n"  /* PADDR_EXT <= $15     */   
@@ -284,8 +345,11 @@
 		: "=&r" (current), "=&r" (error) : "r" (ptr), "r" (incr), "r" (cxy) : "$3", "$15" );
 		
+    hal_restore_irq( save_sr );
+
     *old = current;
 		
 	return error;
-}
+
+}  // end hal_remote_atomic_try_add()
 
 /////////////////////////////////////
@@ -294,4 +358,5 @@
                         uint32_t size )
 {
+    uint32_t save_sr;
 	uint32_t i;
 	uint32_t wsize;
@@ -300,4 +365,6 @@
     uint32_t sptr = (uint32_t)GET_PTR( src );
     uint32_t scxy = (uint32_t)GET_CXY( src );
+
+    hal_disable_irq( &save_sr );
 
 	if( (dptr & 0x3) || (sptr & 0x3) ) wsize = 0;  // do it all in bytes
@@ -331,5 +398,37 @@
 		    : : "r"(scxy), "r" (sptr+i), "r"(dcxy), "r" (dptr+i) : "$3", "$15" );		
 	}
-}
-
-
+
+    hal_restore_irq( save_sr );
+
+}  // end hal_remote_memcpy()
+
+///////////////////////////////////
+void hal_remote_strcpy( xptr_t dst,
+                        xptr_t src )
+{
+    uint32_t save_sr;
+    uint32_t dptr = (uint32_t)GET_PTR( dst );
+    uint32_t dcxy = (uint32_t)GET_CXY( dst );
+    uint32_t sptr = (uint32_t)GET_PTR( src );
+    uint32_t scxy = (uint32_t)GET_CXY( src );
+
+    hal_disable_irq( &save_sr );
+
+    // loop on characters while non NUL 
+    asm volatile(
+        "mfc2   $15,   $24          \n"   /* $15 <= PADDR_EXT               */
+        "1:                         \n"   /* loop entry                     */
+        "mtc2   %0,    $24          \n"   /* PADDR_EXT <= scxy              */   
+        "lb	    $13,   0(%1)        \n"   /* read char from src string      */
+        "mtc2   %2,    $24          \n"   /* PADDR_EXT <= dcxy              */   
+	    "sb	    $13,   0(%3)        \n"   /* store char to dst string       */
+        "addi   %1,    %1,  1       \n"   /* increment sptr pointer         */
+        "addi   %3,    %3,  1       \n"   /* increment dptr pointer         */
+        "bne    $13,   $0,  1b      \n"   /* test NUL                       */
+        "nop                        \n"
+        "mtc2   $15,   $24          \n"   /* PADDR_EXT <= $15               */   
+        : : "r"(scxy), "r"(sptr), "r"(dcxy), "r"(dptr) : "$13","$15", "memory" );
+
+    hal_restore_irq( save_sr );
+
+} // end hal_remote_strcpy()
