[uClibc-cvs] uClibc/libpthread/linuxthreads/sysdeps/i386 pt-machine.h,1.2,1.3 sigcontextinfo.h,1.2,NONE stackinfo.h,1.1,NONE

Erik Andersen andersen at codepoet.org
Mon Mar 3 20:59:05 UTC 2003


Update of /var/cvs/uClibc/libpthread/linuxthreads/sysdeps/i386
In directory winder:/tmp/cvs-serv13798/libpthread/linuxthreads/sysdeps/i386

Modified Files:
	pt-machine.h 
Removed Files:
	sigcontextinfo.h stackinfo.h 
Log Message:
Initial effort at adding profiling support.


Index: pt-machine.h
===================================================================
RCS file: /var/cvs/uClibc/libpthread/linuxthreads/sysdeps/i386/pt-machine.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pt-machine.h	27 Feb 2003 18:12:48 -0000	1.2
+++ pt-machine.h	3 Mar 2003 20:57:28 -0000	1.3
@@ -35,6 +35,52 @@
 #define CURRENT_STACK_FRAME  __builtin_frame_address (0)
 
 
+/* See if we can optimize for newer cpus... */
+#if defined __GNUC__ && __GNUC__ >= 2 && defined __i486__ || defined __pentium__ || defined __pentiumpro__
+
+/* Spinlock implementation; required.  */
+PT_EI long int
+testandset (int *spinlock)
+{
+  long int ret;
+
+  __asm__ __volatile__ (
+	"xchgl %0, %1"
+	: "=r" (ret), "=m" (*spinlock)
+	: "0" (1), "m" (*spinlock)
+	: "memory");
+
+  return ret;
+}
+
+/* Compare-and-swap for semaphores.  It's always available on i686.  */
+#define HAS_COMPARE_AND_SWAP
+
+PT_EI int
+__compare_and_swap (long int *p, long int oldval, long int newval)
+{
+  char ret;
+  long int readval;
+
+  __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0"
+			: "=q" (ret), "=m" (*p), "=a" (readval)
+			: "r" (newval), "m" (*p), "a" (oldval)
+			: "memory");
+  return ret;
+}
+
+#if __ASSUME_LDT_WORKS > 0
+#include "../useldt.h"
+#endif
+
+/* The P4 and above really want some help to prevent overheating.  */
+#define BUSY_WAIT_NOP	__asm__ ("rep; nop")
+
+
+#else /* Generic i386 implementation */
+
+
+
 /* Spinlock implementation; required.  */
 PT_EI long int
 testandset (int *spinlock)
@@ -103,6 +149,8 @@
      Otherwise, it's a 486 or above and it has cmpxchg.  */
   return changed != 0;
 }
+#endif /* Generic i386 implementation */
+
 #endif /* __ASSEMBLER__ */
 
 #endif /* pt-machine.h */

--- sigcontextinfo.h DELETED ---

--- stackinfo.h DELETED ---




More information about the uClibc-cvs mailing list