Message ID | 557e98d2a46b8bccd0379e9a538fd617c07e06e6.1532559484.git.alistair.francis@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 270D4139A for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 25 Jul 2018 23:07:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 081342A671 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 25 Jul 2018 23:07:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC65C2A677; Wed, 25 Jul 2018 23:07:42 +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=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,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 A964A2A671 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 25 Jul 2018 23:07:41 +0000 (UTC) Received: from localhost ([::1]:56626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1fiSse-0005Gb-UO for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 Jul 2018 19:07:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <prvs=7372f4cb7=Alistair.Francis@wdc.com>) id 1fiSpZ-0002TX-Um for qemu-devel@nongnu.org; Wed, 25 Jul 2018 19:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <prvs=7372f4cb7=Alistair.Francis@wdc.com>) id 1fiSpW-0004cL-V4 for qemu-devel@nongnu.org; Wed, 25 Jul 2018 19:04:29 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:37281) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from <prvs=7372f4cb7=Alistair.Francis@wdc.com>) id 1fiSpW-0004bv-Hg for qemu-devel@nongnu.org; Wed, 25 Jul 2018 19:04:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1532559866; x=1564095866; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=hUU12yogHH0Qm59D7Fkndm01FIpqbuByQ29kMNsQ8t4=; b=ZRt9QIn2J4+xpFq/GgyuVbNLY8SnlGhDiyIiWVszBBYoPsok0qJFH6ma KFsU51dSB4R5AizqAcEj+zCtieknnYDEdjUKxK6/9nfLA915zp4pocE+s tYOdagMIHsbJFn9eOg9GbivzrV2Ef6nAsG4JtwhBDAnNgp0kRn8CMvKmL SQbcrWgTRFyug9+3I/Lvw6xJLevLwWmlc/Q2PTisUQzJ+Z83ET6fHcn9q K3h80Ml5WnNCRQPOUrjqsAVi1klwLalDpPugilHCnCiYC4C1QiRXiID4e DuxdyD611rVoDyieUTxK8cBhJ2McanrNIafShAGQPFRF5YtqijY+k5b5X w==; X-IronPort-AV: E=Sophos;i="5.51,402,1526313600"; d="scan'208";a="188676510" Received: from mail-bl2nam02lp0084.outbound.protection.outlook.com (HELO NAM02-BL2-obe.outbound.protection.outlook.com) ([207.46.163.84]) by ob1.hgst.iphmx.com with ESMTP; 26 Jul 2018 07:04:24 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LD+pylikBAaTyMY3OFrHA8gEQ9/DMmfpWINl5CsDwKY=; b=awTQCNGCyXKxFf6JLrxgdifFoULWhyTujqHi5MhgLgrOBqcE+Xjd+8ppNP7DwWL9IkoACUZt+n3KJJQXdIoIDiYKIZeTqaexl/Ngnh271Q17X4FzSUiQZdzHitwjyVmAGAHyRJkrvFbeWFKYA4Gp0crrDhcw9nCqMcHcR6nU1/o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alistair.Francis@wdc.com; Received: from risc6-mainframe.int.fusionio.com (199.255.44.171) by MWHPR04MB0399.namprd04.prod.outlook.com (2603:10b6:300:70::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.20; Wed, 25 Jul 2018 23:04:22 +0000 From: Alistair Francis <alistair.francis@wdc.com> To: qemu-devel@nongnu.org, mjc@sifive.com Date: Wed, 25 Jul 2018 16:04:13 -0700 Message-Id: <557e98d2a46b8bccd0379e9a538fd617c07e06e6.1532559484.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <cover.1532559484.git.alistair.francis@wdc.com> References: <cover.1532559484.git.alistair.francis@wdc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [199.255.44.171] X-ClientProxiedBy: CO2PR04CA0065.namprd04.prod.outlook.com (2603:10b6:102:1::33) To MWHPR04MB0399.namprd04.prod.outlook.com (2603:10b6:300:70::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b80e2f25-d75f-4108-a39b-08d5f282f5df X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:MWHPR04MB0399; X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0399; 3:0FTMeiJ3Sx9Fp5FszDLBjV/RAJMyyiThI/Kx4d1Ef/G4gZBbVLaQpuYiVPPxiIa82sgfMYtCzs+u17P0037wkZxbtsSDAB3hTwIUmCu1ssKJFHYIyPD+2vLzuo15+ewpfR6sT4OfgH3SmP4jBiK8UM3FtmWcINfqZLCMTdUhIWAM2MBWsx/ULmfV2e7qEzXGjhHe4bo4mACVYG3MhfnWzbO4vO04VVMRwLF8bwOyRLT1IcV9fkKTfdVtAtkxsDsD; 25:BUqZ/G6blvVmrUHvpbsGTX813NklfzFUMywNByJMBi9P2ccl2W0uhgcR8lZ4dNTe+2dziKUFBni+bacQC6Qp85wRZ6sOYcncMz4+JLxtL6VM3ryhspqB5+dC6tgWs/Tjam8L1xTNn/VhVJ1YopBjfUO99W8PMo+h+ZvmRTvuLEstgUybbqr5YGzF54aEtXzg6rUW6KB72VgQpqwCM9mvFkH5Lj+Di6PMz7SDx2pQoc816CPyq0tZzJo9NBWh/V60k7Ow/UUhGMA2IyD38obywoZmSVmdrUY7VciZpqS00JECsQlUFXJrnYg2alF+LJKn9Cb+XD2Zz0G+roLYdzWLdw==; 31:sKzwbiN2PV4qPfPlV3SDllqjyjr0Eadz6Ne6sM6GxlDYnRarirO2gSXGvD4pQP7aDPzNGfylRhdxmuGV1oZRO7zkC3bdt6GE8ixi1Z0JhMZ2x9CMHKeKI+5hwWPms+LinnCJspvZdSG0Nln1xJCIlZuZPe1DgwKn3ApoqUhdaWTzjM3U3TlDl8++SF+6UUoEgJJdV1YZlwvLW/VD/0wi/AM4N/gpnHVIXt9PYnOqJdw= X-MS-TrafficTypeDiagnostic: MWHPR04MB0399: WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0399; 20:uf+jQHFi16IVgGQlv/T9PLaY4rEIlabi+qbS6Pqm0YIgxcxpTbO2Np5bZjAlxao9P1vnjlIkhWLzDs7Zit2ur/vP53YOyjmFFmaQaXq4FHA2H0cqQTVFCPFh+cxWd5wHn2HtUwrirdp4aY78kuTHf/WPemp1lJqD0Zg8LChQlDxLH5xXhWl2d6W8u4Vlk6+My4EQfQ57jx5NKKgNh+n4KOIDhN/OlErNDR6glwI+EmtkITvxOIJx6MaLIbhWODXgWFJQOgbzqmvsLtYoJCvRldVk1LeA3MT656pr9u3qLM3qqHz+8VXXEyv+K0Yo3RUkHazAWa2aqIrahM38y1J0x4cmSQNAtoRR8ziRjCEnQpHv4gipcVc1uGIp1vib2uqrZwTtYsLlQMgkLi34fIm7ZKzsANYS0qDCttAxevKolarFnCs/yH5YJ8MmK3dLwIYyp6BQxZhCER1yvZ8Q58+Bq+Yp6hmNGc+/q0FFQQ9hdzineAZ87b5XsoL59MLTmE2D; 4:lMMIiiBOF1xB/RBex5/Qqm1MOUVW+OKdAXBOBrBu4b8qhNIBt8nqRNZ6JTQzaZB7PBg9Q8lKEOhFWmPmp8iWaMXl7y33n6s4a2WTzmdoCto7z/LTQYD9smMJneJypqFkVwDlgSD8+nq2XbvfwBhx6HAw0ycQ4isbcCSpNUDo4R85EvYu/qmDMoGQslKtUj8+9yPAwiwQF6R//vd/DB05q82BmNf1C6MQ7/rr+7wyCSiQjoqxv9hnWpFSlRcnHVXU9EpPz6fBVKoIZzSlcCNCuw== X-Microsoft-Antispam-PRVS: <MWHPR04MB03998A6B7626247957D20BDA90540@MWHPR04MB0399.namprd04.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:MWHPR04MB0399; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0399; X-Forefront-PRVS: 0744CFB5E8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(366004)(39860400002)(346002)(396003)(136003)(189003)(199004)(478600001)(316002)(2616005)(16586007)(476003)(72206003)(44832011)(186003)(6506007)(86362001)(76176011)(386003)(81166006)(50226002)(51416003)(956004)(52116002)(16526019)(68736007)(39060400002)(4326008)(26005)(50466002)(81156014)(8676002)(48376002)(6116002)(6666003)(25786009)(53936002)(47776003)(11346002)(446003)(36756003)(105586002)(6512007)(486006)(66066001)(118296001)(97736004)(106356001)(7736002)(3846002)(8936002)(305945005)(2906002)(5660300001)(6486002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0399; H:risc6-mainframe.int.fusionio.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR04MB0399; 23:SrkW8y8K326cikyYD1Yd9hwJq1ROa2I6WVso0TWKd?= XrVmQtzISCsaSEKh5dyZuNtwJChCjWsI4JEzdVkk3qA4s4kx1HCnfhgCAtcN3aHZgiUkPwppJsETFgCB7eAUuXV761Y1+W5FzkDLHPcgUGU8s8BOPCAnzIJVisCsaHHId37EnwIVmbIwqV/tQ6vwvFPFGfZyUQWV6DZsYdQgiG/9pxbsoepWWYvKE+boLcAlreaKniiB9h1zjWu4Hcjmw9P4vDIHBY0YaoroA2uAMm20IvKdS/LIzkHRhPtq2HGIicx1IRvhSapUzgyjbD7GnUuSzoYZS6WvkLvsWE0U/XDg3EerKPPa0lqK0a8PBP1qJPWOLnerSgO2ekzXUou/IpQqEz9Ga4PidN9WeJYG8c8zoexfuF4NSsWuusni05b8fF+6ZmhqHijz0shIckTaf/9jfsLoZxGouHHQpTu6cODiyT+EaQT0QUhCWdGksyCUWRONvlXzzpOrh1fpfpIi87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PR04MB0399; 20:tXN6YIbnTophlt8U6VnkhLtr+TSkB9so5/Z1WafLhjAGDCnqqOciBG32v27dxdo3cDGMP5MJnmDJhGVX9LB8zjClqCj5tYXamBLncfKItf5x4RWSVxf2W3jpXMAnfLD7daongEvofUHBDLLgKribw1eLN3Ut5brpm2zCtfeyOWw= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2018 23:04:22.6006 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b80e2f25-d75f-4108-a39b-08d5f282f5df X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0399 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 68.232.141.245 Subject: [Qemu-devel] [PATCH v1 3/4] target/riscv: Implement the stval illegal instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: alistair23@gmail.com, alistair.francis@wdc.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
RISC-V: Populate mtval and stval
|
expand
|
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 1bc46aa952..b797850816 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -86,7 +86,8 @@ so a cpu features bitfield is required */ enum { RISCV_FEATURE_MMU, - RISCV_FEATURE_MTVAL_INST + RISCV_FEATURE_MTVAL_INST, + RISCV_FEATURE_STVAL_INST }; #define USER_VERSION_2_02_0 0x00020200 diff --git a/target/riscv/helper.c b/target/riscv/helper.c index bd78bcff28..924a49d06f 100644 --- a/target/riscv/helper.c +++ b/target/riscv/helper.c @@ -466,9 +466,18 @@ void riscv_cpu_do_interrupt(CPUState *cs) ": badaddr 0x" TARGET_FMT_lx, env->mhartid, env->badaddr); } env->stval = env->badaddr; + } else if (cs->exception_index & RISCV_EXCP_ILLEGAL_INST) { + if (riscv_feature(env, RISCV_FEATURE_STVAL_INST)) { + /* The stval register can optionally also be used to + * return the faulting instruction bits on an illegal + * instruction exception. + */ + env->stval = env->bins; + } else { + env->stval = 0; + } } else { - /* otherwise we must clear sbadaddr/stval - * todo: support populating stval on illegal instructions */ + /* Otherwise we must clear mbadaddr/stval */ env->stval = 0; }
The stval register can optionally contain the faulting instruction on an illegal instruction exception. This patch adds support for setting the stval register based on the CPU feature. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> --- target/riscv/cpu.h | 3 ++- target/riscv/helper.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-)