]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgomp/config/linux/x86/futex.h
Update copyright years.
[thirdparty/gcc.git] / libgomp / config / linux / x86 / futex.h
index 2592217a89033115215375c95b2e4022e6dfbae6..ead74d1496736a49694ef6b9b2b4da50f9852664 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
    Contributed by Richard Henderson <rth@redhat.com>.
 
    This file is part of the GNU Offloading and Multi Processing Library
 static inline void
 futex_wait (int *addr, int val)
 {
-  register long r10 __asm__("%r10");
   long res;
 
-  r10 = 0;
+  register long r10 __asm__("%r10") = 0;
   __asm volatile ("syscall"
                  : "=a" (res)
                  : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wait),
@@ -46,7 +45,6 @@ futex_wait (int *addr, int val)
     {
       gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
       gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
-      r10 = 0;
       __asm volatile ("syscall"
                      : "=a" (res)
                      : "0" (SYS_futex), "D" (addr), "S" (gomp_futex_wait),
@@ -81,43 +79,49 @@ futex_wake (int *addr, int count)
 #  define SYS_futex    240
 # endif
 
-static inline long
-sys_futex0 (int *addr, int op, int val)
+static inline void
+futex_wait (int *addr, int val)
 {
   long res;
 
   __asm volatile ("int $0x80"
                  : "=a" (res)
-                 : "0"(SYS_futex), "b" (addr), "c"(op),
-                   "d"(val), "S"(0)
+                 : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wait),
+                   "d" (val), "S" (0)
                  : "memory");
-  return res;
-}
-
-static inline void
-futex_wait (int *addr, int val)
-{
-  long res = sys_futex0 (addr, gomp_futex_wait, val);
   if (__builtin_expect (res == -ENOSYS, 0))
     {
       gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
       gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
-      sys_futex0 (addr, gomp_futex_wait, val);
+      __asm volatile ("int $0x80"
+                     : "=a" (res)
+                     : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wait),
+                       "d" (val), "S" (0)
+                     : "memory");
     }
 }
 
 static inline void
 futex_wake (int *addr, int count)
 {
-  long res = sys_futex0 (addr, gomp_futex_wake, count);
+  long res;
+
+  __asm volatile ("int $0x80"
+                 : "=a" (res)
+                 : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wake),
+                   "d" (count)
+                 : "memory");
   if (__builtin_expect (res == -ENOSYS, 0))
     {
       gomp_futex_wait &= ~FUTEX_PRIVATE_FLAG;
       gomp_futex_wake &= ~FUTEX_PRIVATE_FLAG;
-      sys_futex0 (addr, gomp_futex_wake, count);
+      __asm volatile ("int $0x80"
+                     : "=a" (res)
+                     : "0" (SYS_futex), "b" (addr), "c" (gomp_futex_wake),
+                       "d" (count)
+                     : "memory");
     }
 }
-
 #endif /* __x86_64__ */
 
 static inline void