From patchwork Wed Apr 14 19:08:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 50202 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CFA2AB7D40 for ; Thu, 15 Apr 2010 07:35:10 +1000 (EST) Received: from localhost ([127.0.0.1]:38869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2AEk-0003XU-U3 for incoming@patchwork.ozlabs.org; Wed, 14 Apr 2010 17:35:06 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O29Xh-00053h-Jh for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:37 -0400 Received: from [140.186.70.92] (port=35706 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O29XY-0004tJ-R1 for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O29XS-0001Wh-Cf for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:28 -0400 Received: from are.twiddle.net ([75.149.56.221]:41970) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O29XR-0001WH-MI for qemu-devel@nongnu.org; Wed, 14 Apr 2010 16:50:21 -0400 Received: by are.twiddle.net (Postfix, from userid 5000) id 28DA1EC4; Wed, 14 Apr 2010 13:50:21 -0700 (PDT) Message-Id: In-Reply-To: References: From: Richard Henderson Date: Wed, 14 Apr 2010 12:08:28 -0700 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 20/21] tcg-i386: Tidy lea. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Implement full modrm+sib addressing mode processing. Use that in qemu_ld/st to output the LEA. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c | 91 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 60 insertions(+), 31 deletions(-) diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index d8367b0..4dec422 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -176,6 +176,7 @@ static inline int tcg_target_const_match(tcg_target_long val, #define OPC_JCC_short (0x70) /* ... plus condition code */ #define OPC_JMP_long (0xe9) #define OPC_JMP_short (0xeb) +#define OPC_LEA (0x8d) #define OPC_MOVB_EvGv (0x88) /* stores, more or less */ #define OPC_MOVL_EvGv (0x89) /* stores, more or less */ #define OPC_MOVL_GvEv (0x8b) /* loads, more or less */ @@ -277,40 +278,70 @@ static inline void tcg_out_modrm(TCGContext *s, int opc, int r, int rm) tcg_out8(s, 0xc0 | (r << 3) | rm); } -/* rm == -1 means no register index */ -static inline void tcg_out_modrm_offset(TCGContext *s, int opc, int r, int rm, - int32_t offset) +/* Output an opcode with a full "rm + (index<