From patchwork Thu May 27 20:46:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 53832 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 0ED97B7D1E for ; Fri, 28 May 2010 08:07:39 +1000 (EST) Received: from localhost ([127.0.0.1]:57685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHlEm-0003cP-68 for incoming@patchwork.ozlabs.org; Thu, 27 May 2010 18:07:36 -0400 Received: from [140.186.70.92] (port=56307 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHjzY-0002IX-Ch for qemu-devel@nongnu.org; Thu, 27 May 2010 16:47:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHjzX-0005Rv-AV for qemu-devel@nongnu.org; Thu, 27 May 2010 16:47:48 -0400 Received: from are.twiddle.net ([75.149.56.221]:51255) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHjzX-0005Rf-3n for qemu-devel@nongnu.org; Thu, 27 May 2010 16:47:47 -0400 Received: from anchor.twiddle.home (anchor.twiddle.home [172.31.0.4]) by are.twiddle.net (Postfix) with ESMTPS id 786B347E; Thu, 27 May 2010 13:47:46 -0700 (PDT) Received: from anchor.twiddle.home (anchor.twiddle.home [127.0.0.1]) by anchor.twiddle.home (8.14.4/8.14.4) with ESMTP id o4RKljrW031022; Thu, 27 May 2010 13:47:45 -0700 Received: (from rth@localhost) by anchor.twiddle.home (8.14.4/8.14.4/Submit) id o4RKlj8m031021; Thu, 27 May 2010 13:47:45 -0700 From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 27 May 2010 13:46:26 -0700 Message-Id: <1274993204-30766-45-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.0.1 In-Reply-To: <1274993204-30766-1-git-send-email-rth@twiddle.net> References: <1274993204-30766-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: agraf@suse.de, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 44/62] tcg-s390: Tidy user qemu_ld/st. 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 Create a tcg_prepare_user_ldst to prep the host address to be used to implement the guest memory operation. Signed-off-by: Richard Henderson --- tcg/s390/tcg-target.c | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-) diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c index 000a646..fa089ab 100644 --- a/tcg/s390/tcg-target.c +++ b/tcg/s390/tcg-target.c @@ -1047,6 +1047,17 @@ static void tcg_finish_qemu_ldst(TCGContext* s, uint16_t *label2_ptr) *(label2_ptr + 1) = ((unsigned long)s->code_ptr - (unsigned long)label2_ptr) >> 1; } +#else +static void tcg_prepare_user_ldst(TCGContext *s, TCGReg *addr_reg, + TCGReg *index_reg, tcg_target_long *disp) +{ + *index_reg = 0; + *disp = 0; + if (TARGET_LONG_BITS == 32) { + tgen_ext32u(s, TCG_TMP0, *addr_reg); + *addr_reg = TCG_TMP0; + } +} #endif /* CONFIG_SOFTMMU */ /* load data with address translation (if applicable) @@ -1057,6 +1068,9 @@ static void tcg_out_qemu_ld(TCGContext* s, const TCGArg* args, int opc) #if defined(CONFIG_SOFTMMU) int mem_index; uint16_t *label2_ptr; +#else + TCGReg index_reg; + tcg_target_long disp; #endif data_reg = *args++; @@ -1072,12 +1086,8 @@ static void tcg_out_qemu_ld(TCGContext* s, const TCGArg* args, int opc) tcg_finish_qemu_ldst(s, label2_ptr); #else - if (TARGET_LONG_BITS == 32) { - tgen_ext32u(s, TCG_TMP0, addr_reg); - tcg_out_qemu_ld_direct(s, opc, data_reg, TCG_TMP0, 0, 0); - } else { - tcg_out_qemu_ld_direct(s, opc, data_reg, addr_reg, 0, 0); - } + tcg_prepare_user_ldst(s, &addr_reg, &index_reg, &disp); + tcg_out_qemu_ld_direct(s, opc, data_reg, addr_reg, index_reg, disp); #endif } @@ -1087,6 +1097,9 @@ static void tcg_out_qemu_st(TCGContext* s, const TCGArg* args, int opc) #if defined(CONFIG_SOFTMMU) int mem_index; uint16_t *label2_ptr; +#else + TCGReg index_reg; + tcg_target_long disp; #endif data_reg = *args++; @@ -1102,12 +1115,8 @@ static void tcg_out_qemu_st(TCGContext* s, const TCGArg* args, int opc) tcg_finish_qemu_ldst(s, label2_ptr); #else - if (TARGET_LONG_BITS == 32) { - tgen_ext32u(s, TCG_TMP0, addr_reg); - tcg_out_qemu_st_direct(s, opc, data_reg, TCG_TMP0, 0, 0); - } else { - tcg_out_qemu_st_direct(s, opc, data_reg, addr_reg, 0, 0); - } + tcg_prepare_user_ldst(s, &addr_reg, &index_reg, &disp); + tcg_out_qemu_st_direct(s, opc, data_reg, addr_reg, index_reg, disp); #endif }