From patchwork Wed Jun 21 12:59:14 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: 9801817 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 54AB760234 for ; Wed, 21 Jun 2017 13:19:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 434452074F for ; Wed, 21 Jun 2017 13:19:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 382682856F; Wed, 21 Jun 2017 13:19:32 +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 D55572074F for ; Wed, 21 Jun 2017 13:19:31 +0000 (UTC) Received: from localhost ([::1]:53913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNfXe-00010p-C3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Jun 2017 09:19:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNfEE-0008Fu-Ne for qemu-devel@nongnu.org; Wed, 21 Jun 2017 08:59:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNfEE-0008Vv-0Y for qemu-devel@nongnu.org; Wed, 21 Jun 2017 08:59:26 -0400 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:33327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNfED-0008VJ-Ps for qemu-devel@nongnu.org; Wed, 21 Jun 2017 08:59:25 -0400 Received: by mail-lf0-x242.google.com with SMTP id u62so20947942lfg.0 for ; Wed, 21 Jun 2017 05:59:25 -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=QaoFNezuv6RLVhSFTOBn+VUZ/FkMCpnNnON3vh7I4PI=; b=cu8GX7f9H+Gb1/Gz6glNBVgeCl0r7s27NQAs3MoQMcDnaPCiHpwJx9pH1TagqzRbhr x2Yhhviw00vQW4Hp1JOzIW/98JELSguF0W2KMGBrVXpjlUinv7DbOJJ0mizqzFAJ7sO5 uNO1UPT9DVSNZz0j8np4eQklq3XQd0yVeB20u/vKbqlQCNGU4t7YyUNz2+1VqfO4wLSp M/CXQW7yXMpcExr/69fpiiibbTEeUIq1WU1AKpWBqRdEfztwN6NPqdvyOafidHexT8WY AKyHN3ZYK6JRS5nuIomd90etQumBrACCT0J1Ogl1x7MTUOZSCOTQmCWha88e1QnXYD/b hG5w== 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=QaoFNezuv6RLVhSFTOBn+VUZ/FkMCpnNnON3vh7I4PI=; b=Mc10r3bKvnw8yrUkBmobliBU/Q3MXfdNvd7LeOizMvIFQCVEs9DKLYufbRKkXbcu2Y qI9utfIM2pzPli0xqgmztCD+PVbSxOEFPivxuVD4CgVuBrE5FAydzI5dhI72WYsNW3n4 lQzF4RUr0yCy65Svf4iCqSeNKO5l4n9JJCxk5TSRcEwNCAHWEx32TQKAFK364T9Dc0dJ vbAuwQ/hKsMDxloMwnKidY4PIJrcDK80AyXX6eJzv7H/5+47KlOaOpzmS/MvTYhDy82C fz1Dj52gsZpeTW2Dte4Me4qZmxQNl31eh6bTCTj2EexvAtx+hYcqZ8Lc7mVULbjBb3nk t35g== X-Gm-Message-State: AKS2vOz7DRjTsKcJ0oIpnR2L1ymScGKqBMKxnybMLfimnQ+y2RJoi/CF GTzY3ShjFXFRWVuo X-Received: by 10.46.88.86 with SMTP id x22mr10096680ljd.106.1498049964246; Wed, 21 Jun 2017 05:59:24 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id s203sm3722394lja.65.2017.06.21.05.59.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 05:59:23 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Wed, 21 Jun 2017 14:59:14 +0200 Message-Id: <1498049955-28646-7-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498049955-28646-1-git-send-email-edgar.iglesias@gmail.com> References: <1498049955-28646-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::242 Subject: [Qemu-devel] [PATCH v2 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 Reviewed-by: Richard Henderson --- 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 3fad13c..cb65d1e 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); @@ -692,6 +693,17 @@ static void dec_barrel(DisasContext *dc) } else { 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 (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();