Commit 6ddd6e83 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Support the Android Java %fs register being a GDT selector.

parent 2bf8293e
......@@ -1671,6 +1671,7 @@ static jstring wine_init_jni( JNIEnv *env, jobject obj, jobjectArray cmdline, jo
{
unsigned short java_fs;
__asm__( "mov %%fs,%0" : "=r" (java_fs) );
if (!(java_fs & 4)) java_gdt_sel = java_fs;
__asm__( "mov %0,%%fs" :: "r" (0) );
start_main_thread();
__asm__( "mov %0,%%fs" :: "r" (java_fs) );
......
......@@ -258,9 +258,11 @@ static inline void wrap_java_call(void) { __asm__( "mov %0,%%fs" :: "r" (java_
static inline void unwrap_java_call(void) { __asm__( "mov %0,%%fs" :: "r" (orig_fs) ); }
static inline void init_java_thread( JavaVM *java_vm )
{
java_fs = *p_java_gdt_sel;
__asm__( "mov %%fs,%0" : "=r" (orig_fs) );
__asm__( "mov %0,%%fs" :: "r" (java_fs) );
(*java_vm)->AttachCurrentThread( java_vm, &jni_env, 0 );
__asm__( "mov %%fs,%0" : "=r" (java_fs) );
if (!*p_java_gdt_sel) __asm__( "mov %%fs,%0" : "=r" (java_fs) );
__asm__( "mov %0,%%fs" :: "r" (orig_fs) );
}
......
......@@ -622,6 +622,7 @@ static void load_android_libs(void)
JavaVM **p_java_vm = NULL;
jobject *p_java_object = NULL;
unsigned short *p_java_gdt_sel = NULL;
static BOOL process_attach(void)
{
......@@ -635,6 +636,7 @@ static BOOL process_attach(void)
p_java_vm = dlsym( ntdll, "java_vm" );
p_java_object = dlsym( ntdll, "java_object" );
p_java_gdt_sel = dlsym( ntdll, "java_gdt_sel" );
object = *p_java_object;
......
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