[uClibc-cvs] uClibc/libpthread/linuxthreads/sysdeps/mips pt-machine.h,1.1,1.2

Erik Andersen andersen at codepoet.org
Thu Jan 23 07:58:33 UTC 2003


Update of /var/cvs/uClibc/libpthread/linuxthreads/sysdeps/mips
In directory winder:/tmp/cvs-serv590/linuxthreads/sysdeps/mips

Modified Files:
	pt-machine.h 
Log Message:
Per patch from Nathan Field at ghs.com, fix the mips __compare_and_swap inline
function.  Without this fix, pthread_mutex_lock/pthread_mutex_unlock don't work
on mips.


Index: pt-machine.h
===================================================================
RCS file: /var/cvs/uClibc/libpthread/linuxthreads/sysdeps/mips/pt-machine.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pt-machine.h	20 Feb 2002 09:18:48 -0000	1.1
+++ pt-machine.h	23 Jan 2003 07:58:29 -0000	1.2
@@ -77,6 +77,7 @@
 	"1:\tll\t%0,%4\n\t"
 	".set\tnoreorder\n\t"
 	"bne\t%0,%2,2f\n\t"
+       "move\t%0,$0\n\t" /*[NDF] Failure case. */
 	"move\t%0,%3\n\t"
 	".set\treorder\n\t"
 	"sc\t%0,%1\n\t"
@@ -87,4 +88,30 @@
 	: "r"(oldval), "r"(newval), "m"(*p));
 
   return ret;
+
+  /*
+    1:  load locked: into ret(%0), from *p(0(%4))
+        branch to 2 if ret(%0) != oldval(%2)
+         Delay slot: move 0 into ret(%0) // [NDF] Added
+       Don't branch case:
+       move newval(%3) into ret(%0)
+       setcompare ret(%0) into *p(0(%1))
+       branch to 1 if ret(%0) == 0 (sc failed)
+         Delay slot: unknown/none
+       return
+
+    2: Delay slot
+       return
+
+ll a b
+Sets a to the value pointed to by address b, and "locks" b so that if
+any of a number of things are attempted that might access b then the
+next sc will fail.
+
+sc a b
+Sets the memory address pointed to by b to the value in a atomically.
+If it succeeds then a will be set to 1, if it fails a will be set to 0.
+
+  */
+
 }




More information about the uClibc-cvs mailing list