This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [trans-mem] fix futex syscall for x86_64


Hello,

In 32 bit version, esi (4th parameter, ie timeout) is set to 0 even if it is wait or wake.
So I guess you might do the same in 64bit. Otherwise, your previous patch seems ok if you want to avoid the useless operation in case of wake operation.


Patrick Marlier.

* futex_bits.h (sys_futex0): Always set 4th parameter (r10) to 0 for futex system call.

Index: ../transactional-memory/libitm/config/linux/x86/futex_bits.h
===================================================================
--- ../transactional-memory/libitm/config/linux/x86/futex_bits.h (revision 157407)
+++ ../transactional-memory/libitm/config/linux/x86/futex_bits.h (working copy)
@@ -30,11 +30,13 @@
static inline long
sys_futex0 (int *addr, long op, long val)
{
+ register long r10 __asm__("%r10");
long res;


+ r10 = 0;
__asm volatile ("syscall"
: "=a" (res)
- : "0" (SYS_futex), "D" (addr), "S" (op), "d" (val)
+ : "0" (SYS_futex), "D" (addr), "S" (op), "d" (val), "r" (r10)
: "r11", "rcx", "memory");


return res;

Aldy Hernandez wrote:
On Mon, Mar 22, 2010 at 10:09:40AM -0700, Richard Henderson wrote:
On 03/22/2010 09:01 AM, Aldy Hernandez wrote:
+/* Define sys_futex0_wait if backend's wait syscall is different than
+   the wake.  See x86_64 for an example.  */
+#ifndef sys_futex0_wait
+#define sys_futex0_wait sys_futex0
+#endif
Not ok. All targets have the same arguments.

I don't get it. How am I changing the number of arguments passed to sys_futex0?

Do you want me to set r10 to 0 both for the x86-64 futex_wait and for
the futex_wake?  On libgomp/config/linux/x86/futex.h we set r10 only for
the futex_wait variant.

Confused.
Aldy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]