From patchwork Wed Mar 21 20:46:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10300425 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 71BB060386 for ; Wed, 21 Mar 2018 21:12:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AAC029849 for ; Wed, 21 Mar 2018 21:12:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 589E8299A7; Wed, 21 Mar 2018 21:12:12 +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_SIGNED, 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 7B6492999B for ; Wed, 21 Mar 2018 21:11:38 +0000 (UTC) Received: from localhost ([::1]:57488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyl1F-0006Er-Dn for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Mar 2018 17:11:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykeb-0002Ep-Sb for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eykeb-0002El-48 for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:48:13 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:42630) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eykea-0002Dc-Ui for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:48:13 -0400 Received: by mail-pg0-x243.google.com with SMTP id f10so2237777pgs.9 for ; Wed, 21 Mar 2018 13:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hd/yhk1mRLDT2WAL6LhvHkcI9lNEqFu50q34yfE+BSM=; b=HbPLtDmGntB49WXaJhetr2S/bFk7eMT68NHuph0tokV8WCBWFsSWJa36bKNzfa5yj5 JXKbgs3xirX8bf1xQRiPoTNXP/7V+eoL+CftSwRYjfayAyOCTwrt7fxZ2Tdgk5luOJzR PK5ZYubxiE3AGkccDdjN3f/9eCjWkUn3DhRMF9qaAhgWwnqQQPwMKi9Uo38zclcUfdm3 QXMedqbL7QhUUKeFhl2Jhn0IlnFrpok+DE/zsZ96Yd84snTXfN2NXJpqz7MaOX5Ra92/ hPaJ623fACSAt+FnbYdKr/XhdFgwPYAAhtZISZGbHCVD+hMH8HBDrx1BtRDMX0i0b9C+ Mzig== 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=hd/yhk1mRLDT2WAL6LhvHkcI9lNEqFu50q34yfE+BSM=; b=CG4dHv9tbf4/KwXtOWoR2COxvwdun9dkHf/p8Or9QTVkuGM+gvgCyeYtSBfTEO4Jkw pLLzE/97s0ZSagTkwtPMJrT06CLREWR7Mo82aAD+mHhtVVVEseVYCXW0bA9g51aIiizx q7aT1cS7koES4WN3W82AUHwTFFC7opJFA2Q9HDXJtj9hwc3YZjHjqqdzvTgLGj2qsHhu 5lmvwfEnsggkqkM+p+Jk1irmYNK1jzrQjN3ERpdcvQcAGowYXCGKzoYq+685I52ysinZ ZzcNF3HK38zQs+vlokdNGyXZScVRxEG74IS0zVF9KMxfCPoHQUlpz4IHzJtmrV8ZtDzT 1C6Q== X-Gm-Message-State: AElRT7GeX8FEwOJHujCERqF6Ex1uVk9f/5RS6GAT6AmuPzEvW7+t/gzJ dPblasgxdfHYmjyrLRC6GIyKBZfqAu0= X-Google-Smtp-Source: AG47ELuOsNSJ/IgWcfOP9YokIfOADcB7s54pdW7xa180/W+DeN0NuiOhFTONM1POJ/IdYwMR3X5/Yw== X-Received: by 10.101.71.202 with SMTP id f10mr15550516pgs.366.1521665291978; Wed, 21 Mar 2018 13:48:11 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id w10sm8244499pgr.57.2018.03.21.13.48.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Mar 2018 13:48:11 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Wed, 21 Mar 2018 13:46:59 -0700 Message-Id: <1521665220-3869-24-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521665220-3869-1-git-send-email-mjc@sifive.com> References: <1521665220-3869-1-git-send-email-mjc@sifive.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PULL 23/24] RISC-V: Clear mtval/stval on exceptions without info 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: patches@groups.riscv.org, Michael Clark , Palmer Dabbelt , Sagar Karandikar , Bastian Koppelmann Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP mtval/stval must be set on all exceptions but zero is a legal value if there is no exception specific info. Placing the instruction bytes for illegal instruction exceptions in mtval/stval is an optional feature and is currently not supported by QEMU RISC-V. Cc: Sagar Karandikar Cc: Bastian Koppelmann Signed-off-by: Palmer Dabbelt Signed-off-by: Michael Clark --- target/riscv/helper.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/riscv/helper.c b/target/riscv/helper.c index b2e3f45..0d802a8 100644 --- a/target/riscv/helper.c +++ b/target/riscv/helper.c @@ -489,6 +489,10 @@ void riscv_cpu_do_interrupt(CPUState *cs) ": badaddr 0x" TARGET_FMT_lx, env->mhartid, env->badaddr); } env->sbadaddr = env->badaddr; + } else { + /* otherwise we must clear sbadaddr/stval + * todo: support populating stval on illegal instructions */ + env->sbadaddr = 0; } target_ulong s = env->mstatus; @@ -510,6 +514,10 @@ void riscv_cpu_do_interrupt(CPUState *cs) ": badaddr 0x" TARGET_FMT_lx, env->mhartid, env->badaddr); } env->mbadaddr = env->badaddr; + } else { + /* otherwise we must clear mbadaddr/mtval + * todo: support populating mtval on illegal instructions */ + env->mbadaddr = 0; } target_ulong s = env->mstatus;