From patchwork Fri Feb 12 14:33:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 8292361 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ACECCC1F0D for ; Fri, 12 Feb 2016 14:37:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA0D6203C1 for ; Fri, 12 Feb 2016 14:37:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 459882039E for ; Fri, 12 Feb 2016 14:37:22 +0000 (UTC) Received: from localhost ([::1]:33132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUEqX-0000iu-KD for patchwork-qemu-devel@patchwork.kernel.org; Fri, 12 Feb 2016 09:37:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUEqG-0000f6-K1 for qemu-devel@nongnu.org; Fri, 12 Feb 2016 09:37:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUEqC-0002gh-Hs for qemu-devel@nongnu.org; Fri, 12 Feb 2016 09:37:04 -0500 Received: from mail-pa0-x243.google.com ([2607:f8b0:400e:c03::243]:35232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUEqC-0002ga-74; Fri, 12 Feb 2016 09:37:00 -0500 Received: by mail-pa0-x243.google.com with SMTP id fl4so3884088pad.2; Fri, 12 Feb 2016 06:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b90yldKzeIG660WGwHVvKsMno2SNK6wcv8kCSk48vXY=; b=X4go8EhMdCBrAu9OBgQaHhAJE36TtZpw2gtlcduBzO1+7cAs2lkZHhYqn2sGdqrp/0 pyR3JnctMSZwGMpTMBVE7yarHe0uIlPW2uo8btFIJRMFbRLZi0L3WmyN9ju058n+NSKm j/tdGxstwfMG2COwsE590JuNd6VGfn2Sb3eARZ7ZCN6REn2fdPmgSwCkPisLnrV0T+PF 2Zbkgt+rmvI/Xs2gTNVcv5ycDCg5Bb2qI95e5UEHXvSeoI4do6obMU04/D7qp5kYuilh 1drQGah03o9qg2PnEsBVPSDCk7AnEtQjUhjnS0AJ3GD3scoZSRaV/pLbTgJ5Q9TvtFRh UcAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b90yldKzeIG660WGwHVvKsMno2SNK6wcv8kCSk48vXY=; b=KYHtaEkPx89XbqyWT5qflTx4Tjsa4Byvadt8/s7tHasO/jM3fDnl+93X1SGWx9oxWK bL/HCuZa8wSkdvJ9UHYuO4/fn233kK+lb0kNmP0buBZmbEvePGEW05Ap5tzlsuUMmEnH vM9W6TvCSpgePimS0wQPi5/J1Lu6KaIOsn5F8L1kD9xCrsSPySQxnvOaPf0YFVfQBdw0 jXCaZhRKIk1tNbmeNN443VuUxyI2zTZC2KMYgFXdRhPfOkw2vMgBp/JmfsXFBCTqas36 U0ZmDnmeMrKR1kPAot3YK9469apjkLQVebkRs8bxae+l1oACGQ0ciZJWoYQGLaTkRvjj GSYQ== X-Gm-Message-State: AG10YOTqyxPPvfyE8vq29ogVhuRmmu4qHISQWpquqA6SvpoFuFfNFaF/eps3Bv7dsYrrBA== X-Received: by 10.66.218.196 with SMTP id pi4mr2475022pac.147.1455287819577; Fri, 12 Feb 2016 06:36:59 -0800 (PST) Received: from localhost (ec2-52-8-89-49.us-west-1.compute.amazonaws.com. [52.8.89.49]) by smtp.gmail.com with ESMTPSA id tn5sm18951780pac.32.2016.02.12.06.36.58 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 12 Feb 2016 06:36:59 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 12 Feb 2016 15:33:59 +0100 Message-Id: <1455287642-28166-7-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455287642-28166-1-git-send-email-edgar.iglesias@gmail.com> References: <1455287642-28166-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::243 Cc: edgar.iglesias@xilinx.com, serge.fdrv@gmail.com, qemu-arm@nongnu.org, alex.bennee@linaro.org, rth@twiddle.net Subject: [Qemu-devel] [PATCH v1 6/9] target-arm/translate-a64.c: Unify some of the ldst_reg decoding 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" The various load/store variants under disas_ldst_reg can all reuse the same decoding for opc, size, rt and is_vector. This patch unifies the decoding in preparation for generating instruction syndromes for data aborts. This will allow us to reduce the number of places to hook in updates to the load/store state needed to generate the insn syndromes. No functional change. Signed-off-by: Edgar E. Iglesias Reviewed-by: Sergey Fedorov --- target-arm/translate-a64.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index bf31f8a..9e26d5e 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -2075,19 +2075,19 @@ static void disas_ldst_pair(DisasContext *s, uint32_t insn) * size: 00 -> 8 bit, 01 -> 16 bit, 10 -> 32 bit, 11 -> 64bit * opc: 00 -> store, 01 -> loadu, 10 -> loads 64, 11 -> loads 32 */ -static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn) +static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn, + int opc, + int size, + int rt, + bool is_vector) { - int rt = extract32(insn, 0, 5); int rn = extract32(insn, 5, 5); int imm9 = sextract32(insn, 12, 9); - int opc = extract32(insn, 22, 2); - int size = extract32(insn, 30, 2); int idx = extract32(insn, 10, 2); bool is_signed = false; bool is_store = false; bool is_extended = false; bool is_unpriv = (idx == 2); - bool is_vector = extract32(insn, 26, 1); bool post_index; bool writeback; @@ -2194,19 +2194,19 @@ static void disas_ldst_reg_imm9(DisasContext *s, uint32_t insn) * Rn: address register or SP for base * Rm: offset register or ZR for offset */ -static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn) +static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn, + int opc, + int size, + int rt, + bool is_vector) { - int rt = extract32(insn, 0, 5); int rn = extract32(insn, 5, 5); int shift = extract32(insn, 12, 1); int rm = extract32(insn, 16, 5); - int opc = extract32(insn, 22, 2); int opt = extract32(insn, 13, 3); - int size = extract32(insn, 30, 2); bool is_signed = false; bool is_store = false; bool is_extended = false; - bool is_vector = extract32(insn, 26, 1); TCGv_i64 tcg_rm; TCGv_i64 tcg_addr; @@ -2283,14 +2283,14 @@ static void disas_ldst_reg_roffset(DisasContext *s, uint32_t insn) * Rn: base address register (inc SP) * Rt: target register */ -static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn) +static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn, + int opc, + int size, + int rt, + bool is_vector) { - int rt = extract32(insn, 0, 5); int rn = extract32(insn, 5, 5); unsigned int imm12 = extract32(insn, 10, 12); - bool is_vector = extract32(insn, 26, 1); - int size = extract32(insn, 30, 2); - int opc = extract32(insn, 22, 2); unsigned int offset; TCGv_i64 tcg_addr; @@ -2349,20 +2349,25 @@ static void disas_ldst_reg_unsigned_imm(DisasContext *s, uint32_t insn) /* Load/store register (all forms) */ static void disas_ldst_reg(DisasContext *s, uint32_t insn) { + int rt = extract32(insn, 0, 5); + int opc = extract32(insn, 22, 2); + bool is_vector = extract32(insn, 26, 1); + int size = extract32(insn, 30, 2); + switch (extract32(insn, 24, 2)) { case 0: if (extract32(insn, 21, 1) == 1 && extract32(insn, 10, 2) == 2) { - disas_ldst_reg_roffset(s, insn); + disas_ldst_reg_roffset(s, insn, opc, size, rt, is_vector); } else { /* Load/store register (unscaled immediate) * Load/store immediate pre/post-indexed * Load/store register unprivileged */ - disas_ldst_reg_imm9(s, insn); + disas_ldst_reg_imm9(s, insn, opc, size, rt, is_vector); } break; case 1: - disas_ldst_reg_unsigned_imm(s, insn); + disas_ldst_reg_unsigned_imm(s, insn, opc, size, rt, is_vector); break; default: unallocated_encoding(s);