From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeR4z-0006aN-EA for qemu-devel@nongnu.org; Fri, 21 Aug 2009 06:10:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeR4u-0006YV-Fk for qemu-devel@nongnu.org; Fri, 21 Aug 2009 06:10:40 -0400 Received: from [199.232.76.173] (port=41728 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeR4u-0006YR-8Q for qemu-devel@nongnu.org; Fri, 21 Aug 2009 06:10:36 -0400 Received: from cantor.suse.de ([195.135.220.2]:36468 helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MeR4t-00066z-Qe for qemu-devel@nongnu.org; Fri, 21 Aug 2009 06:10:36 -0400 From: Ulrich Hecht Subject: Re: [Qemu-devel] [PATCH] i386-linux-user NPTL support Date: Fri, 21 Aug 2009 12:10:31 +0200 References: <1250785143-24969-1-git-send-email-uli@suse.de> <20090820164304.GP29075@codesourcery.com> In-Reply-To: <20090820164304.GP29075@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Message-Id: <200908211210.31928.uli@suse.de> Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nathan Froyd Cc: Riku Voipio , qemu-devel@nongnu.org On Thursday 20 August 2009, Nathan Froyd wrote: > Why not just stick things in cpu_set_tls in target-i386/cpu.h like so: > > #if defined(TARGET-I386) && defined(TARGET_ABI32) > static inline void cpu_set_tls(CPUState *env, target_ulong newtls) > { > do_set_thread_area(env, newtls); > cpu_x86_load_seg(env, R_GS, env->segs[R_GS].selector); > } > #endif > > Less duplicated code and fewer #ifdefs that way and it's still clear > that x86-64 linux-user emulation doesn't support NPTL. do_set_thread_area() is declared static in syscall.c, so you would have=20 to unstaticize it, create a prototype somewhere (where?), and you would=20 introduce a dependency between the CPU emulation and the userspace=20 emulation. These problems are all unique to the i386 architecture which=20 doesn't get away with just setting a CPU register like all the others.=20 (Except maybe x86-64, but I don't know how TLS is implemented there.) My=20 solution may not look as clean, but it sidesteps all this, which I=20 thought made it worthwhile to special-case i386 in syscall.c. CU Uli --=20 SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N=FCrnberg)