wineandroid: Avoid using wine_get/set_fs().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-04-03 10:46:29 +02:00
parent e3160986d0
commit 44c9355676
2 changed files with 9 additions and 8 deletions

View file

@ -39,7 +39,6 @@
#include "ddk/wdm.h"
#include "android.h"
#include "wine/server.h"
#include "wine/library.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(android);
@ -255,14 +254,14 @@ static inline BOOL is_client_in_process(void)
#ifdef __i386__ /* the Java VM uses %fs/%gs for its own purposes, so we need to wrap the calls */
static WORD orig_fs, java_fs;
static inline void wrap_java_call(void) { wine_set_fs( java_fs ); }
static inline void unwrap_java_call(void) { wine_set_fs( orig_fs ); }
static inline void wrap_java_call(void) { __asm__( "mov %0,%%fs" :: "r" (java_fs) ); }
static inline void unwrap_java_call(void) { __asm__( "mov %0,%%fs" :: "r" (orig_fs) ); }
static inline void init_java_thread( JavaVM *java_vm )
{
orig_fs = wine_get_fs();
__asm__( "mov %%fs,%0" : "=r" (orig_fs) );
(*java_vm)->AttachCurrentThread( java_vm, &jni_env, 0 );
java_fs = wine_get_fs();
wine_set_fs( orig_fs );
__asm__( "mov %%fs,%0" : "=r" (java_fs) );
__asm__( "mov %0,%%fs" :: "r" (orig_fs) );
}
#elif defined(__x86_64__)

View file

@ -635,7 +635,8 @@ static BOOL process_attach(void)
if ((java_vm = wine_get_java_vm())) /* running under Java */
{
#ifdef __i386__
WORD old_fs = wine_get_fs();
WORD old_fs;
__asm__( "mov %%fs,%0" : "=r" (old_fs) );
#endif
load_android_libs();
(*java_vm)->AttachCurrentThread( java_vm, &jni_env, 0 );
@ -643,7 +644,8 @@ static BOOL process_attach(void)
(*jni_env)->RegisterNatives( jni_env, class, methods, ARRAY_SIZE( methods ));
(*jni_env)->DeleteLocalRef( jni_env, class );
#ifdef __i386__
wine_set_fs( old_fs ); /* the Java VM hijacks %fs for its own purposes, restore it */
/* the Java VM hijacks %fs for its own purposes, restore it */
__asm__( "mov %0,%%fs" :: "r" (old_fs) );
#endif
}
return TRUE;