From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeAMT-0002K9-8X for qemu-devel@nongnu.org; Thu, 20 Aug 2009 12:19:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeAMN-0002Cf-JR for qemu-devel@nongnu.org; Thu, 20 Aug 2009 12:19:36 -0400 Received: from [199.232.76.173] (port=60638 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeAMN-0002CN-7s for qemu-devel@nongnu.org; Thu, 20 Aug 2009 12:19:31 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35218 helo=mx2.suse.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MeAMM-0001ii-LB for qemu-devel@nongnu.org; Thu, 20 Aug 2009 12:19:30 -0400 From: Ulrich Hecht Date: Thu, 20 Aug 2009 18:19:03 +0200 Message-Id: <1250785143-24969-1-git-send-email-uli@suse.de> Subject: [Qemu-devel] [PATCH] i386-linux-user NPTL support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Riku Voipio Makes NPTL binaries run by implementing TLS. Signed-off-by: Ulrich Hecht --- configure | 1 + linux-user/syscall.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 824b21c..c3c5d4a 100755 --- a/configure +++ b/configure @@ -1894,6 +1894,7 @@ TARGET_ABI_DIR="" case "$target_arch2" in i386) target_phys_bits=32 + target_nptl="yes" ;; x86_64) TARGET_BASE_ARCH=i386 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5778e32..bbaec3d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3730,8 +3730,14 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp, ts->child_tidptr = child_tidptr; } - 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); @@ -3804,8 +3810,14 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp, 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 + } if (flags & CLONE_CHILD_CLEARTID) ts->child_tidptr = child_tidptr; #endif -- 1.6.4