From patchwork Mon Mar 19 21:18:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10295343 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 237C260385 for ; Mon, 19 Mar 2018 21:43:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 107ED29262 for ; Mon, 19 Mar 2018 21:43:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03C0929279; Mon, 19 Mar 2018 21:43:08 +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 7DD7B2923D for ; Mon, 19 Mar 2018 21:43:07 +0000 (UTC) Received: from localhost ([::1]:44122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2Yc-000553-Bs for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Mar 2018 17:43:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2CK-0001YA-Jc for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:20:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey2CJ-0002oE-NC for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:20:04 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:38429) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ey2CJ-0002nr-Hl for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:20:03 -0400 Received: by mail-pf0-x244.google.com with SMTP id d26so7557858pfn.5 for ; Mon, 19 Mar 2018 14:20:03 -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=2XB6ShJmEWHPIEHqHmS7j+K/cKmyJbKRpQ+V+MObcu0=; b=G+kzTKo/5hIM+g449bXZ0TQwWU25o5uvU27qsQemdT6P5s7kvQLj+pTb4JKtCDMaPD NC0U9iO3tsWvJGeeuwZWpbyYnQXgVfMe34jkAgEQ0wwIV20faNwKMHYYaDqSlVVir1dd IczldYlrZ9EkCthUe3yQ2UfD9A0eaBPS9glPObXR/NIYtj2M29xSnNiZ7B03+K6IEa6R 8/KfWoRVhXggDYxeFppgb9/h7i3TRM/9wndLN4u1ji9bL+R+jhZrHXYR+monVAIrZJ21 ToE4bLSruGRqO1ukBRfiEh1PIlkSwIHC3aNanznoxFrFA6lLkATApSyJkgwvScb/VUmW MMwA== 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=2XB6ShJmEWHPIEHqHmS7j+K/cKmyJbKRpQ+V+MObcu0=; b=BHIGm2QDt0OuM4TrU9PmHQWH6HYnoRdxUcVxzlUmopmWl+oZPOwZqdK5ZLQ4tT+vib AdSpnKy2YVFit3MeA1Alv+bIFIaMGpWY/KKos0zZXj1Ptka6/RsbVuJBQh7DJf8Xuphg tQO6V09SaoT19n7TVaBJqNEDTG9QXX2epKH2Hv7ulxaPpFq29vqtXzxwI5vyBfXRIo6W X34cDsUHO8RAWvJYFKl1A4bytdK07+xnfl9gKFO/FT2VAwMlB0FMiUqWKzqDYxFks0iH 51RzynT61MmDdmsP8M9G4x+7M5nBB6QZntic4hOFwJwteDyhTzpXVmV5Q0qpoJSW2555 oaew== X-Gm-Message-State: AElRT7FPB8JPBQehl4kA8E363DS3lIE8WKLO5bCvO1jb7ZAw8LyDqhxS H8ltgiKQeayunuDikikrlqeVf/4OD/E= X-Google-Smtp-Source: AG47ELuaiHFu0foxoE3WhkJ3lhDMk3z2C0exdbkmJCKJXhSB3k18rnqwNuocQ6dnPN//M7iLZyx0OQ== X-Received: by 10.98.82.144 with SMTP id g138mr11312368pfb.239.1521494402638; Mon, 19 Mar 2018 14:20:02 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id i127sm120500pfc.136.2018.03.19.14.20.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Mar 2018 14:20:02 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 14:18:47 -0700 Message-Id: <1521494329-19546-25-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521494329-19546-1-git-send-email-mjc@sifive.com> References: <1521494329-19546-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:c00::244 Subject: [Qemu-devel] [PATCH v4 24/26] 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 cfbf1d1..cdce68d 100644 --- a/target/riscv/helper.c +++ b/target/riscv/helper.c @@ -502,6 +502,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; @@ -523,6 +527,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;