From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBt7k-0006MX-Og for qemu-devel@nongnu.org; Wed, 12 Sep 2012 16:01:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBt7b-0003IG-7m for qemu-devel@nongnu.org; Wed, 12 Sep 2012 16:01:24 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:52906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBt7b-0003IA-1Z for qemu-devel@nongnu.org; Wed, 12 Sep 2012 16:01:15 -0400 Message-ID: <5050EA08.3020708@weilnetz.de> Date: Wed, 12 Sep 2012 22:01:12 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1347473022-17017-1-git-send-email-sw@weilnetz.de> <20120912191451.GB6791@ohm.aurel32.net> In-Reply-To: <20120912191451.GB6791@ohm.aurel32.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] w64: Fix calls of TCG helper functions with 5 arguments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno Cc: Blue Swirl , Peter Maydell , qemu-devel@nongnu.org Am 12.09.2012 21:14, schrieb Aurelien Jarno: > On Wed, Sep 12, 2012 at 07:12:47PM +0100, Peter Maydell wrote: >> On 12 September 2012 19:03, Stefan Weil wrote: >>> diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c >>> index da17bba..43b5572 100644 >>> --- a/tcg/i386/tcg-target.c >>> +++ b/tcg/i386/tcg-target.c >>> @@ -118,7 +118,7 @@ static void patch_reloc(uint8_t *code_ptr, int type, >>> static inline int tcg_target_get_call_iarg_regs_count(int flags) >>> { >>> if (TCG_TARGET_REG_BITS == 64) { >>> - return 6; >>> + return ARRAY_SIZE(tcg_target_call_iarg_regs); >>> } >>> >>> return 0; >> >> Hmm. Why can't we just return the array size in all cases? >> Is there something special about 32 bit x86? I checked, and >> all our other TCG targets return the same value as the size of >> the iarg_regs array (either using ARRAY_SIZE or by just returning >> the right number)... >> > > On 32-bit x86, all arguments are now being passed on the stack, that's > why the function returns 0. On the other hand when the change has been > done, the registers haven't been removed from tcg_target_call_iarg_regs. > > I think this patch is fine enough for 1.2, but a better patch is needed > for master. As soon as the special case x86 with 32 bit is fixed or eliminated, it should be possible that all TCG targets share the same code for tcg_target_get_call_iarg_regs_count. That function could be removed from the target specific implementations and moved to tcg.c.