From patchwork Fri Apr 29 12:08:03 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: 8980441 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6A5BD9F39D for ; Fri, 29 Apr 2016 12:11:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86A492021A for ; Fri, 29 Apr 2016 12:11:38 +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 781AF201ED for ; Fri, 29 Apr 2016 12:11:37 +0000 (UTC) Received: from localhost ([::1]:53878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7Gf-00074m-Cq for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Apr 2016 08:11:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7EB-0002oL-5p for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:09:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw7Dz-0001wC-0y for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:08:53 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7Dx-0001oM-L0; Fri, 29 Apr 2016 08:08:46 -0400 Received: by mail-wm0-x242.google.com with SMTP id w143so4515334wmw.3; Fri, 29 Apr 2016 05:08:17 -0700 (PDT) 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=cxdPDfJp2aqsTISMW21ehBX5vcD1ylnjvWXmF9PWLrY=; b=Wub7mWwZ/KY0dDWfG+rlTA2Y5EUcVnQOWtrDCXcprB9vONo3KXamyrShkWSyFnT+yu N14g5125PNKgDxueh7A2ukfd+R9qIomzXWWluBEXyphP7FRRFcVN2BFLKrJf2ukuiw0g Zoc9ZcOysSrmhIYpsbnjlB8QsATpwtq6uu1Gs7mk8NGtlTQpEEZP9AqmIX9lTJcxPpe+ lsN2MuCASY9MsUFtCvIGiUH7LP0f5knezk8OuXHwn1gUZO2kY9q36kbyqg+SQsN5bTE6 134AsS5NmGfM4Zqsg4bfnbpR0nqKIw4nOOq4M5FAixSkAnCsHv9zcoTjPAYsCicd+6jG bPzg== 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=cxdPDfJp2aqsTISMW21ehBX5vcD1ylnjvWXmF9PWLrY=; b=JlrWbNOfOx9AUQgtMRPcKeEAWXWOfmXn9VK5bruzdOjEkd+71ndL41WDqIz2892f2r pTnbNfzTQDZRPQDTylJFv1tS7malKofA/DZhxfVWHeCvndwnAEyvaXM2eoUUH09wB+Md D0H+a4dAE6xkvlZC1dS/PrpTlKAZ9pwDejpiaTORdtG9DFqgTH5Cn9Tm3N4Z8i8Zstmc hzY9DaVXdXiYfgqVVvnt7A9qYSjiLj42WgRI18Uf1lu8CVIi17OU3FAl3HrM7YgQUaLn RRCK0aXJAjDH3uzvIr4bi54+DHJD7nWGzw9Da8rbViodfz+nXiNd35be5fkAT67hNgQl NWLg== X-Gm-Message-State: AOPr4FVhNUS+392uD4Fp4lgmE9ciINiY8WqLVsofSr0/CYGoBtgMbn15AFxJFUhJoYtMjQ== X-Received: by 10.194.116.103 with SMTP id jv7mr22919489wjb.22.1461931693926; Fri, 29 Apr 2016 05:08:13 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id gk4sm14459542wjd.7.2016.04.29.05.08.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Apr 2016 05:08:13 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 29 Apr 2016 14:08:03 +0200 Message-Id: <1461931684-1867-7-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461931684-1867-1-git-send-email-edgar.iglesias@gmail.com> References: <1461931684-1867-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: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v3 6/7] target-arm/translate-a64.c: Unify some of the ldst_reg decoding X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, serge.fdrv@gmail.com, qemu-arm@nongnu.org, alex.bennee@linaro.org, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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. Reviewed-by: Sergey Fedorov Signed-off-by: Edgar E. Iglesias --- 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 5c8dddb..24f5e17 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -2086,19 +2086,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; @@ -2205,19 +2205,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; @@ -2294,14 +2294,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; @@ -2360,20 +2360,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);