From patchwork Thu Aug 29 21:09:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 270948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4DFAA2C00B1 for ; Fri, 30 Aug 2013 07:11:20 +1000 (EST) Received: from localhost ([::1]:45803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF9Us-0003Uy-Cj for incoming@patchwork.ozlabs.org; Thu, 29 Aug 2013 17:11:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF9UB-0003O2-Eb for qemu-devel@nongnu.org; Thu, 29 Aug 2013 17:10:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF9U6-0001pV-8l for qemu-devel@nongnu.org; Thu, 29 Aug 2013 17:10:35 -0400 Received: from mail-qa0-x234.google.com ([2607:f8b0:400d:c00::234]:52417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF9U5-0001pI-RY for qemu-devel@nongnu.org; Thu, 29 Aug 2013 17:10:29 -0400 Received: by mail-qa0-f52.google.com with SMTP id ii20so732365qab.4 for ; Thu, 29 Aug 2013 14:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=nq2y9Pk7eWQqs80++jN06qeOhufSTUO8UG9lezE8zVs=; b=v+kjLs39LgTSPoXzEn0aBOPNaI73hBLBD5gwjRJM6nf+eXzy4EQX0JfxtvIMUITL3P I0hVa6LA+JDvm14IAToKoFvFzHp4V+bLMnab5ByKtJ3QhP7phoaHYO/Nr08RbOoGd4I7 EjKWfiZTvjjJVlGX9bdZgNx4Txo7IQNURWW6uc/+BRAPLKdMeBOIKqOyLIZLHL3l4ZlO 6CBGaSTqKZENdHJmlbN1kBJQ3BbYAB9tXluNtJ0168/fReuj5NQiC/iOnj5jjlm0VG3z dg+XtCgUymT/ITK2WvG7lvUeH19AjR1eZr+D0enKboFdl1RxOx0+oO/IH8ZQrczg+7Sf zUbA== X-Received: by 10.229.103.135 with SMTP id k7mr6577765qco.22.1377810629517; Thu, 29 Aug 2013 14:10:29 -0700 (PDT) Received: from anchor.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id j11sm46864113qaa.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 29 Aug 2013 14:10:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 29 Aug 2013 14:09:33 -0700 Message-Id: <1377810586-19931-6-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1377810586-19931-1-git-send-email-rth@twiddle.net> References: <1377810586-19931-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c00::234 Cc: aurelien@aurel32.net Subject: [Qemu-devel] [PATCH v2 05/18] tcg: Allow TCG_TARGET_REG_BITS to be specified independantly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There are several hosts for which it would be useful to use the available 64-bit registers in a 32-bit pointer environment. Reviewed-by: Aurelien Jarno Signed-off-by: Richard Henderson --- tcg/hppa/tcg-target.c | 4 ++++ tcg/hppa/tcg-target.h | 4 ---- tcg/i386/tcg-target.h | 10 ++++++---- tcg/sparc/tcg-target.h | 8 ++++++++ tcg/tcg.h | 19 +++++++++++-------- tcg/tci/tcg-target.h | 8 ++++++++ 6 files changed, 37 insertions(+), 16 deletions(-) diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c index 68f77ba..e5aed91 100644 --- a/tcg/hppa/tcg-target.c +++ b/tcg/hppa/tcg-target.c @@ -22,6 +22,10 @@ * THE SOFTWARE. */ +#if TCG_TARGET_REG_BITS != 32 +#error unsupported +#endif + #ifndef NDEBUG static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = { "%r0", "%r1", "%rp", "%r3", "%r4", "%r5", "%r6", "%r7", diff --git a/tcg/hppa/tcg-target.h b/tcg/hppa/tcg-target.h index a9257a5..302cf4e 100644 --- a/tcg/hppa/tcg-target.h +++ b/tcg/hppa/tcg-target.h @@ -25,10 +25,6 @@ #ifndef TCG_TARGET_HPPA #define TCG_TARGET_HPPA 1 -#if TCG_TARGET_REG_BITS != 32 -#error unsupported -#endif - #define TCG_TARGET_WORDS_BIGENDIAN #define TCG_TARGET_NB_REGS 32 diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 963e839..53914f1 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -24,12 +24,14 @@ #ifndef TCG_TARGET_I386 #define TCG_TARGET_I386 1 -//#define TCG_TARGET_WORDS_BIGENDIAN +#undef TCG_TARGET_WORDS_BIGENDIAN -#if TCG_TARGET_REG_BITS == 64 -# define TCG_TARGET_NB_REGS 16 +#ifdef __x86_64__ +# define TCG_TARGET_REG_BITS 64 +# define TCG_TARGET_NB_REGS 16 #else -# define TCG_TARGET_NB_REGS 8 +# define TCG_TARGET_REG_BITS 32 +# define TCG_TARGET_NB_REGS 8 #endif typedef enum { diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index d1ca2d6..d356c1b 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -24,6 +24,14 @@ #ifndef TCG_TARGET_SPARC #define TCG_TARGET_SPARC 1 +#if UINTPTR_MAX == UINT32_MAX +# define TCG_TARGET_REG_BITS 32 +#elif UINTPTR_MAX == UINT64_MAX +# define TCG_TARGET_REG_BITS 64 +#else +# error Unknown pointer size for tcg target +#endif + #define TCG_TARGET_WORDS_BIGENDIAN #define TCG_TARGET_NB_REGS 32 diff --git a/tcg/tcg.h b/tcg/tcg.h index bfe420a..b26e557 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -23,13 +23,17 @@ */ #include "qemu-common.h" -/* Target word size (must be identical to pointer size). */ -#if UINTPTR_MAX == UINT32_MAX -# define TCG_TARGET_REG_BITS 32 -#elif UINTPTR_MAX == UINT64_MAX -# define TCG_TARGET_REG_BITS 64 -#else -# error Unknown pointer size for tcg target +#include "tcg-target.h" + +/* Default target word size to pointer size. */ +#ifndef TCG_TARGET_REG_BITS +# if UINTPTR_MAX == UINT32_MAX +# define TCG_TARGET_REG_BITS 32 +# elif UINTPTR_MAX == UINT64_MAX +# define TCG_TARGET_REG_BITS 64 +# else +# error Unknown pointer size for tcg target +# endif #endif #if TCG_TARGET_REG_BITS == 32 @@ -46,7 +50,6 @@ typedef uint64_t tcg_target_ulong; #error unsupported #endif -#include "tcg-target.h" #include "tcg-runtime.h" #if TCG_TARGET_NB_REGS <= 32 diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 18f57a2..4811e99 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -44,6 +44,14 @@ #define TCG_TARGET_INTERPRETER 1 +#if UINTPTR_MAX == UINT32_MAX +# define TCG_TARGET_REG_BITS 32 +#elif UINTPTR_MAX == UINT64_MAX +# define TCG_TARGET_REG_BITS 64 +#else +# error Unknown pointer size for tci target +#endif + #ifdef CONFIG_DEBUG_TCG /* Enable debug output. */ #define CONFIG_DEBUG_TCG_INTERPRETER