about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--linuxthreads/ChangeLog5
-rw-r--r--linuxthreads/sysdeps/ia64/pt-machine.h5
-rw-r--r--linuxthreads/sysdeps/x86_64/pt-machine.h5
-rw-r--r--nptl/ChangeLog3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h7
5 files changed, 22 insertions, 3 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index e6ed4e4051..442dc0b513 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-23  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/ia64/pt-machine.h (BUSY_WAIT_NOP): Define.
+	* sysdeps/x86_64/pt-machine.h (BUSY_WAIT_NOP): Likewise.
+
 2004-03-12  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/bits/local_lim.h: Add HOST_NAME_MAX.
diff --git a/linuxthreads/sysdeps/ia64/pt-machine.h b/linuxthreads/sysdeps/ia64/pt-machine.h
index ee489a7fc0..a04ae81e2c 100644
--- a/linuxthreads/sysdeps/ia64/pt-machine.h
+++ b/linuxthreads/sysdeps/ia64/pt-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent pthreads configuration and inline functions.
    IA-64 version.
-   Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -127,4 +127,7 @@ testandset (int *spinlock)
   return ret;
 }
 
+/* Indicate that we are looping.  */
+#define BUSY_WAIT_NOP	__asm__ ("hint @pause")
+
 #endif /* pt-machine.h */
diff --git a/linuxthreads/sysdeps/x86_64/pt-machine.h b/linuxthreads/sysdeps/x86_64/pt-machine.h
index bd53069a78..68baac7d03 100644
--- a/linuxthreads/sysdeps/x86_64/pt-machine.h
+++ b/linuxthreads/sysdeps/x86_64/pt-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent pthreads configuration and inline functions.
    x86-64 version.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -219,4 +219,7 @@ extern int __arch_prctl (int __code, unsigned long __addr);
 /* Maximum size of the stack if the rlimit is unlimited.  */
 #define ARCH_STACK_MAX_SIZE	32*1024*1024
 
+/* The ia32e really want some help to prevent overheating.  */
+#define BUSY_WAIT_NOP	__asm__ ("rep; nop")
+
 #endif /* pt-machine.h */
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index e0439e1fdc..5155b79ae9 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,6 +1,9 @@
 2004-03-23  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/i386/lowlevellock.h (lll_mutex_trylock):
+	No need to restrict type of ret.  Make it int.  Add comment.
+
+	* sysdeps/unix/sysv/linux/i386/lowlevellock.h (lll_mutex_trylock):
 	Remove unnecessary setne instruction.
 
 2004-03-22  Jakub Jelinek  <jakub@redhat.com>
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
index 9f089f8e6e..a9823d8d4b 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -102,8 +102,13 @@ extern int __lll_mutex_unlock_wake (int *__futex)
      __attribute ((regparm (1))) attribute_hidden;
 
 
+/* NB: in the lll_mutex_trylock macro we simply return the value in %eax
+   after the cmpxchg instruction.  In case the operation succeded this
+   value is zero.  In case the operation failed, the cmpxchg instruction
+   has loaded the current value of the memory work which is guaranteed
+   to be nonzero.  */
 #define lll_mutex_trylock(futex) \
-  ({ unsigned char ret;							      \
+  ({ int ret;								      \
      __asm __volatile (LOCK_INSTR "cmpxchgl %2, %1"			      \
 		       : "=a" (ret), "=m" (futex)			      \
 		       : "r" (LLL_MUTEX_LOCK_INITIALIZER_LOCKED), "m" (futex),\