Commit a6987506 authored by Alexandre Julliard's avatar Alexandre Julliard

libwine: Avoid using wine_get/set_fs().

parent f82a5b61
......@@ -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;
}
......
......@@ -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) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment