From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeTtt-00027d-6P for qemu-devel@nongnu.org; Fri, 21 Aug 2009 09:11:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeTtn-0001yp-Vz for qemu-devel@nongnu.org; Fri, 21 Aug 2009 09:11:24 -0400 Received: from [199.232.76.173] (port=59056 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeTtn-0001yb-SG for qemu-devel@nongnu.org; Fri, 21 Aug 2009 09:11:19 -0400 Received: from mx20.gnu.org ([199.232.41.8]:51483) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MeTtn-00086K-JR for qemu-devel@nongnu.org; Fri, 21 Aug 2009 09:11:19 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MeTtm-00045F-Gv for qemu-devel@nongnu.org; Fri, 21 Aug 2009 09:11:18 -0400 Date: Fri, 21 Aug 2009 06:11:16 -0700 From: Nathan Froyd Subject: Re: [Qemu-devel] [PATCH] i386-linux-user NPTL support Message-ID: <20090821131116.GR29075@codesourcery.com> References: <1250785143-24969-1-git-send-email-uli@suse.de> <20090820164304.GP29075@codesourcery.com> <200908211210.31928.uli@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200908211210.31928.uli@suse.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ulrich Hecht Cc: Riku Voipio , qemu-devel@nongnu.org On Fri, Aug 21, 2009 at 12:10:31PM +0200, Ulrich Hecht wrote: > 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 > > do_set_thread_area() is declared static in syscall.c, so you would have > to unstaticize it, create a prototype somewhere (where?), and you would > introduce a dependency between the CPU emulation and the userspace > emulation. These problems are all unique to the i386 architecture which > doesn't get away with just setting a CPU register like all the others. Hm, that's a good point. I imagine the problems are similar on x86-64. My first thought was to simply move do_set_thread_area and cpu_set_tls (the latter for all architectures, not just x86) to linux-user/target-FOO/syscall.h. But that won't work for ARM, since it uses cpu_set_tls in linux-user/main.c. Maybe creating a new file/header for cpu-specific support code would be the right way to do things; you might have to make cpu_set_tls out-of-line, but that's not particularly bad. (This would help with other things, like moving cpu_loop from linux-user/main.c into architecture-specific files.) But that's a little much to tackle for just x86 NPTL support, I suppose. :) -Nathan