@@ -0,0 +1,46 @@
+Index: linux-user/syscall.c
+================================================================================
+--- configure
++++ configure
+@@ -1610,6 +1610,7 @@
+ echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+ echo "#define CONFIG_KVM 1" >> $config_h
+ fi
++ target_nptl="yes"
+ ;;
+ x86_64)
+ echo "TARGET_ARCH=x86_64" >> $config_mak
+--- linux-user/syscall.c
++++ linux-user/syscall.c
+@@ -3175,8 +3175,14 @@
+ flags &= ~CLONE_NPTL_FLAGS2;
+
+ /* TODO: Implement CLONE_CHILD_CLEARTID. */
+- if (nptl_flags & CLONE_SETTLS)
++ if (nptl_flags & CLONE_SETTLS) {
++#if defined(TARGET_I386) && defined(TARGET_ABI32)
++ do_set_thread_area(new_env, newtls);
++ cpu_x86_load_seg(new_env, R_GS, new_env->segs[R_GS].selector);
++#else
+ cpu_set_tls (new_env, newtls);
++#endif
++ }
+
+ /* Grab a mutex so that thread setup appears atomic. */
+ pthread_mutex_lock(&clone_lock);
+@@ -3247,8 +3253,14 @@
+ if (flags & CLONE_PARENT_SETTID)
+ put_user_u32(gettid(), parent_tidptr);
+ ts = (TaskState *)env->opaque;
+- if (flags & CLONE_SETTLS)
++ if (flags & CLONE_SETTLS) {
++#if defined(TARGET_I386) && defined(TARGET_ABI32)
++ do_set_thread_area(env, newtls);
++ cpu_x86_load_seg(env, R_GS, env->segs[R_GS].selector);
++#else
+ cpu_set_tls (env, newtls);
++#endif
++ }
+ /* TODO: Implement CLONE_CHILD_CLEARTID. */
+ #endif
+ } else {
|