Maarten Lankhorst : ntdll: Use syscall instead of int $0x80.

Alexandre Julliard julliard at winehq.org
Thu Jul 22 12:09:20 CDT 2010


Module: wine
Branch: master
Commit: e8c5e2b890ff28ef90a3c7f38003a7b4c0c00f06
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e8c5e2b890ff28ef90a3c7f38003a7b4c0c00f06

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Sun Jun  6 01:08:20 2010 +0200

ntdll: Use syscall instead of int $0x80.

---

 dlls/ntdll/critsection.c |   24 ++++++++----------------
 dlls/ntdll/server.c      |    4 ++--
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c
index 2846343..8a60109 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -60,26 +60,18 @@ static inline void small_pause(void)
 
 static inline int futex_wait( int *addr, int val, struct timespec *timeout )
 {
-    int res;
-    __asm__ __volatile__( "xchgl %2,%%ebx\n\t"
-                          "int $0x80\n\t"
-                          "xchgl %2,%%ebx"
-                          : "=a" (res)
-                          : "0" (240) /* SYS_futex */, "D" (addr),
-                            "c" (0) /* FUTEX_WAIT */, "d" (val), "S" (timeout) );
-    return res;
+    int ret = syscall( 240/*SYS_futex*/, addr, 0/*FUTEX_WAIT*/, val, timeout, 0, 0 );
+    if (ret < 0)
+        return -errno;
+    return ret;
 }
 
 static inline int futex_wake( int *addr, int val )
 {
-    int res;
-    __asm__ __volatile__( "xchgl %2,%%ebx\n\t"
-                          "int $0x80\n\t"
-                          "xchgl %2,%%ebx"
-                          : "=a" (res)
-                          : "0" (240) /* SYS_futex */, "D" (addr),
-                            "c" (1)  /* FUTEX_WAKE */, "d" (val) );
-    return res;
+    int ret = syscall( 240/*SYS_futex*/, addr, 1/*FUTEX_WAKE*/, val, NULL, 0, 0 );
+    if (ret < 0)
+        return -errno;
+    return ret;
 }
 
 static inline int use_futexes(void)
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 8564c0a..ce27d5d 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -947,9 +947,9 @@ static int get_unix_tid(void)
 {
     int ret = -1;
 #if defined(linux) && defined(__i386__)
-    __asm__("int $0x80" : "=a" (ret) : "0" (224) /* SYS_gettid */);
+    ret = syscall(224 /*SYS_gettid*/);
 #elif defined(linux) && defined(__x86_64__)
-    __asm__("syscall" : "=a" (ret) : "0" (186) /* SYS_gettid */);
+    ret = syscall(186 /*SYS_gettid*/);
 #elif defined(__sun)
     ret = pthread_self();
 #elif defined(__APPLE__)




More information about the wine-cvs mailing list