From patchwork Tue Jun 20 16:09:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9799929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 800F460329 for ; Tue, 20 Jun 2017 16:12:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80CB82624A for ; Tue, 20 Jun 2017 16:12:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73ECA265B9; Tue, 20 Jun 2017 16:12:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A18A223A6 for ; Tue, 20 Jun 2017 16:12:49 +0000 (UTC) Received: from localhost ([::1]:49655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNLlo-0005pj-7a for patchwork-qemu-devel@patchwork.kernel.org; Tue, 20 Jun 2017 12:12:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNLiO-00031Z-6f for qemu-devel@nongnu.org; Tue, 20 Jun 2017 12:09:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNLiN-0003d8-9l for qemu-devel@nongnu.org; Tue, 20 Jun 2017 12:09:16 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:35741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNLiN-0003cl-2E for qemu-devel@nongnu.org; Tue, 20 Jun 2017 12:09:15 -0400 Received: by mail-lf0-x241.google.com with SMTP id n136so4202070lfn.2 for ; Tue, 20 Jun 2017 09:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K45pF3CrTaqwfUq5Kp8wafCAV1GIZVgaB2xoLxVuiuA=; b=u83CKSJU73PScoB/afW7nuBwEX0MHAlypy4NDeBRuZQyPbnuSRKGvIKyZYdXsv5qu/ GBbxak6gIyynSbmGeO88BTI3A3ZNz57FWtCjoH1kTiLESYYzu8zCj3fR/dG9fVnVrvVi ZabRwBwWwDv9v6HaifBiiihEMXk1fn+uWCDcpZtnnXSp+DHDh4c8wDMN4icmmngvLy6m WgDCNVmlbsDAckB9kEptEplxhhLWInYDgDurMd/k84lHpok0Psfcedp15xsd5Y9Y78GR GLMKlrAsCXAe8dmTQP0jpvwF0NUzE9A6aRVMR3a8XTHFs/u6Y8qFP3A4C83VvTLtwlI8 YAww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K45pF3CrTaqwfUq5Kp8wafCAV1GIZVgaB2xoLxVuiuA=; b=WoT41O/ddDWAQYo52ruqOplF2YFY5b3XBlLC52xn538PLCFGiiLwa1UWwB3cpl9mby 4hhutsdUUiwzWGCxOarWd1puqsCsRAFHJwkZ37CTHlHJA1HCW2lMAJ4FFgbMVLktMfE+ zUowLyKFFCN5/xO9GnicsXvKDH2PRkS9DH/u8h+UQQe9N7JPXwYyCzsLifoJDf9El8DP LxH9WmpdEjtpD5smIUikBsz/51QhOv0qQaickEiS9HZ36FXus9yEz6ktU+u9kdOxev+N Rqm5ZYttcXWAQbDjCa3u15fML4d0rdaT226YRvsdDs+YDKScmjL0R9VtZ2bT2+zJ8lIh vLgg== X-Gm-Message-State: AKS2vOxjrVFzcme1Fgxt5YtapXrgrHPFoyO6lM9AXxyidumHWCe21O8L MNwYRpl6R2ipnZ7k X-Received: by 10.25.199.13 with SMTP id x13mr9687099lff.52.1497974953735; Tue, 20 Jun 2017 09:09: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 22sm3091945ljv.62.2017.06.20.09.09.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 09:09:12 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Tue, 20 Jun 2017 18:09:03 +0200 Message-Id: <1497974944-27050-7-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497974944-27050-1-git-send-email-edgar.iglesias@gmail.com> References: <1497974944-27050-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH v1 6/7] target-microblaze: dec_barrel: Add BSIFI 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: sai.pavan.boddu@xilinx.com, edgar.iglesias@xilinx.com, alistai@xilinx.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Add support for BSIFI. Signed-off-by: Edgar E. Iglesias --- target/microblaze/translate.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 4a8ab22..743b66f 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -661,7 +661,7 @@ static void dec_barrel(DisasContext *dc) { TCGv t0; unsigned int imm_w, imm_s; - bool s, t, e = false; + bool s, t, e = false, i = false; if ((dc->tb_flags & MSR_EE_FLAG) && (dc->cpu->env.pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK) @@ -673,6 +673,7 @@ static void dec_barrel(DisasContext *dc) if (dc->type_b) { /* Insert and extract are only available in immediate mode. */ + i = extract32(dc->imm, 15, 1); e = extract32(dc->imm, 14, 1); } s = extract32(dc->imm, 10, 1); @@ -686,6 +687,17 @@ static void dec_barrel(DisasContext *dc) if (e) { tcg_gen_extract_i32(cpu_R[dc->rd], cpu_R[dc->ra], imm_s, imm_w); + } else if (i) { + int width = imm_w - imm_s + 1; + + if (width == 0 || imm_w <= imm_s) { + /* These inputs have an undefined behavior. */ + qemu_log_mask(LOG_GUEST_ERROR, "bsifi: Bad input w=%d s=%d\n", + imm_w, imm_s); + } else { + tcg_gen_deposit_i32(cpu_R[dc->rd], cpu_R[dc->rd], cpu_R[dc->ra], + imm_s, width); + } } else { t0 = tcg_temp_new();