Skip to contentSkip to conversation

i386-linux-user NPTL

PATCH New Ulrich Hecht 1 participant 1 message Feb 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386-linux-user NPTL

Hi!

This enables NPTL for the i386 target. If someone could comment on why the cpu_x86_load_seg() call is necessary, I would appreciate it. It looks like an elaborate nop to me.

syscall.c +14 -2
Index: linux-user/syscall.c
===================================================================
@@ -2937,8 +2937,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);
@@ -3009,8 +3015,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 {
configure +1 -0
Index: configure
===================================================================
@@ -1583,6 +1591,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
Signature · 1 line
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)