From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCDAF-0005PH-GP for qemu-devel@nongnu.org; Mon, 26 Mar 2012 12:53:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCDA7-0006nC-Sk for qemu-devel@nongnu.org; Mon, 26 Mar 2012 12:53:03 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:59894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCDA7-0006mA-JD for qemu-devel@nongnu.org; Mon, 26 Mar 2012 12:52:55 -0400 Received: by pbcuo5 with SMTP id uo5so7532114pbc.4 for ; Mon, 26 Mar 2012 09:52:53 -0700 (PDT) Sender: Richard Henderson Message-ID: <4F709EE2.6030306@twiddle.net> Date: Mon, 26 Mar 2012 09:52:50 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1332714477-30079-1-git-send-email-rth@twiddle.net> <1332714477-30079-10-git-send-email-rth@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/15] tcg-sparc: Do not use a global register for AREG0. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org On 03/26/12 09:31, Blue Swirl wrote: >> > +/* In dyngen-exec.h, without AREG0, we fall back to an alias to cpu_single_env. >> > + We can't actually tell from here whether that's needed or not, but it does >> > + not hurt to go ahead and make the declaration. */ >> > +#ifndef CONFIG_TCG_PASS_AREG0 >> > +extern >> > +#ifdef __linux__ >> > + __thread >> > +#endif >> > + CPUArchState *env __attribute__((alias("tls__cpu_single_env"))); >> > +#endif /* CONFIG_TCG_PASS_AREG0 */ > Please use DECLARE_TLS/DEFINE_TLS and global env accesses should also > use tls_var(). > That won't work. This is intended to be a drop-in replacement for the "env" symbol that we declare in dyngen-exec.h. For all other hosts, this symbol is a global register variable. We can't go wrapping tls_var around all uses in all target backends. As I say in the comment, the most natural replacement is a preprocessor macro, but then that fails with the uses of "env" in the DEF_HELPER_N macros. Which leaves no alternative -- short of converting *all* targets to CONFIG_TCG_PASS_AREG0 first -- except the symbol alias you see there. Hmm... actually... I'm wrong about the use of preprocessor macros. The simple solution there is to re-order the includes on a few ports. I.e. "helper.h" must come before "dyngen-exec.h". Now that's a much simpler fix... r~