Alexandre Julliard : libwine: Avoid using wine_get/set_fs().

Alexandre Julliard julliard at winehq.org
Fri Apr 3 14:55:37 CDT 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Apr  3 10:47:33 2020 +0200

libwine: Avoid using wine_get/set_fs().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/wine/ldt.c    | 11 +++++++----
 libs/wine/loader.c |  7 ++++---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c
index baf12a2e3a..5fabd1968d 100644
--- a/libs/wine/ldt.c
+++ b/libs/wine/ldt.c
@@ -382,7 +382,7 @@ unsigned short wine_ldt_alloc_fs(void)
         int ret;
 
         /* the preloader may have allocated it already */
-        global_fs_sel = wine_get_fs();
+        __asm__( "mov %%fs,%0" : "=r" (global_fs_sel) );
         if (global_fs_sel && is_gdt_sel(global_fs_sel)) return global_fs_sel;
 
         memset( &ldt_info, 0, sizeof(ldt_info) );
@@ -431,7 +431,7 @@ void wine_ldt_init_fs( unsigned short sel, const LDT_ENTRY *entry )
     {
         internal_set_entry( sel, entry );
     }
-    wine_set_fs( sel );
+    __asm__( "mov %0,%%fs" :: "r" (sel) );
 }
 
 
@@ -442,11 +442,14 @@ void wine_ldt_init_fs( unsigned short sel, const LDT_ENTRY *entry )
  */
 void wine_ldt_free_fs( unsigned short sel )
 {
+    WORD fs;
+
     if (is_gdt_sel(sel)) return;  /* nothing to do */
-    if (!((wine_get_fs() ^ sel) & ~3))
+    __asm__( "mov %%fs,%0" : "=r" (fs) );
+    if (!((fs ^ sel) & ~3))
     {
         /* FIXME: if freeing current %fs we cannot acquire locks */
-        wine_set_fs( 0 );
+        __asm__( "mov %0,%%fs" :: "r" (0) );
         internal_set_entry( sel, &null_entry );
         wine_ldt_copy.flags[sel >> 3] = 0;
     }
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index 2a569f5b73..53e33c496a 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -923,10 +923,11 @@ static jstring wine_init_jni( JNIEnv *env, jobject obj, jobjectArray cmdline, jo
 
 #ifdef __i386__
     {
-        unsigned short java_fs = wine_get_fs();
-        wine_set_fs( 0 );
+        unsigned short java_fs;
+        __asm__( "mov %%fs,%0" : "=r" (java_fs) );
+        __asm__( "mov %0,%%fs" :: "r" (0) );
         wine_init( argc, argv, error, sizeof(error) );
-        wine_set_fs( java_fs );
+        __asm__( "mov %0,%%fs" :: "r" (java_fs) );
     }
 #else
     wine_init( argc, argv, error, sizeof(error) );




More information about the wine-cvs mailing list