From patchwork Tue Sep 12 01:40:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 13824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp111319vqx; Mon, 11 Sep 2023 18:41:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsyEk1j41fhz4GpPknMPkNWv68JvOXmaCEiOSvJXxQBf/X6vEVMQDfal8KjyE4I0Hnic5n X-Received: by 2002:a05:6402:1808:b0:52b:c8d9:1d66 with SMTP id g8-20020a056402180800b0052bc8d91d66mr7858415edy.42.1694482879911; Mon, 11 Sep 2023 18:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694482879; cv=none; d=google.com; s=arc-20160816; b=UOx6Ni+XeJCJWztx04F6+lIlGOSTYAAQWOfRMe1NQtRJAYAs+wYxzOfizopYSSL7FA wqMPSftiYcw0HSzA3x1glJZKOG+f/4tKk83lyKVMFr+9rmeYaXgh9XGxR8ss+tVuqGT6 k9AyTxXFWyHPHlh4avfMQheF+8vWNAjvdGGh6e5lB6e4BB8yXxt0H1I7QnvSvckbiFyd T6w6JySNjp5z9a/T7+TdLOYBdcTZf8U15aTvAkHnbIBei290xdCA6ZKc9+IeO92BmMsn e4FGQTAgGx4ZqmfLklb+yrYVBQ9M0Fk8rvACNtkd+g/r6JWOJiUCZUspx0HlDbGR9nzA 7ChA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=pSBxpQvkfR54xjxFbMecb0WPpzZ6FJ2KVqyRFP55scM=; fh=lllctRxEXNnp/GZgTgmlYzny/eXMbSjNA/nbD0Q8v10=; b=GAsZyaabpf3eak3AsoEudjti+bP+XU3txTPGWjw0pXXtLnTioBsR5Eb0BSKIt7BU0p Nv3c0dn/DJbrF6YSrbmNTQD2EnPeJLtW1l73uQWO9M53Rw1fgm5muF5aUdyfrGV/D8O9 FFzw4Dz9m/XVrxkC//mvY1LiWia1nkcejruvRqCBK8cp/+soZWaqCYoQRDFyF4+/Te+D F9MmB726UIQMbDy2yhD4OBGeLGND7FQpH5uE25bSGNxopv7khqMaj8Aj32Hncd9lWgdm EAPIoREDzp+p15BPmJxPrWV5zQ4UIJFIx3iEPtx8241Z64QzwgK7ASmqX6h8nrm0Qg0q cqoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=KH54FEnV; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u15-20020aa7d0cf000000b0052a4603b047si7902102edo.310.2023.09.11.18.41.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 18:41:19 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=KH54FEnV; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E85E385696B for ; Tue, 12 Sep 2023 01:40:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E85E385696B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694482852; bh=pSBxpQvkfR54xjxFbMecb0WPpzZ6FJ2KVqyRFP55scM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=KH54FEnVXIDcWP5x/LNmmaFLIosNKbJRLJhwOhp2HxPkupLzE/vJyy3CaiJYN2Lyc vd3vdFtDW0IOymP5ahcdry9JIlzEMyGkfj8J8tmZMBqhpR/lwJzaZFr2qnqqWoit69 RNVapCMp4/QaAwuod/rWkI4LcLAkM/mKoBQIxBtU= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 9952C3857718 for ; Tue, 12 Sep 2023 01:40:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9952C3857718 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id EB06C300089; Tue, 12 Sep 2023 01:40:40 +0000 (UTC) To: Tsukasa OI Cc: binutils@sourceware.org Subject: [REVIEW ONLY v3 0/1] RISC-V (unratified): Add 'Smrnmi' extension Date: Tue, 12 Sep 2023 01:40:16 +0000 Message-ID: In-Reply-To: References: Mime-Version: 1.0 X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tsukasa OI via Binutils From: Tsukasa OI Reply-To: Tsukasa OI Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1750791607648411779 X-GMAIL-MSGID: 1776794080161813216 *** WAIT FOR SPECIFICATION FREEZE *** This is an implementation for unratified and not frozen RISC-V extension and not intended to be merged for now. The only intent to submit this patchset is to test new instructions for your (possibly virtual) environment and early review for fast adoption after ratification. This is the review-only PATCH v3 to keep track with the latest GNU Binutils. In this version, I didn't add anything new but rebases on the latest master (previous one should cause merge conflicts). This patchset adds following unratified extension to GNU Binutils: - Smrnmi (Resumable NMI) version 0.4 (may change on ratification) ... which adds "mnret" instruction and 4 CSRs related to RNMI. This extension provides "resumable NMIs" to provide special non-maskable interrupts (NMIs) with "resume" capability (normally, NMIs are are only used for hardware error conditions and not resumable; however on some conditions, there are some cases where using NMIs fits better yet resumable after proper handling by the NMI handler [which may fail though]). This is based on a draft version of the RISC-V ISA Manual: Note that it has **different** CSR values between proposed RNMI version 0.4 and RNMI as optionally implemented in SiFive U74-MC: | CSR | proposed | SiFive | | --------- | -------- | ------ | | mnscratch | 0x740 | 0x350 | | mnepc | 0x741 | 0x351 | | mncause | 0x742 | 0x352 | | mnstatus | 0x744 | 0x353 | Also, although that 4 CSRs are assigned with actual numbers (this is why I'm not attaching "CSR instantiation" script in this patchset), it may be changed before ratification. Be careful. Tsukasa OI (1): UNRATIFIED RISC-V: Add 'Smrnmi' extension and its CSRs bfd/elfxx-riscv.c | 6 ++++++ gas/config/tc-riscv.c | 4 ++++ gas/testsuite/gas/riscv/csr-dw-regnums.d | 4 ++++ gas/testsuite/gas/riscv/csr-dw-regnums.s | 5 +++++ gas/testsuite/gas/riscv/csr-version-1p10.d | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p10.l | 16 ++++++++++++++++ gas/testsuite/gas/riscv/csr-version-1p11.d | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p11.l | 16 ++++++++++++++++ gas/testsuite/gas/riscv/csr-version-1p12.d | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p12.l | 16 ++++++++++++++++ gas/testsuite/gas/riscv/csr-version-1p9p1.d | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p9p1.l | 16 ++++++++++++++++ gas/testsuite/gas/riscv/csr.s | 6 ++++++ gas/testsuite/gas/riscv/smrnmi-noarch.d | 3 +++ gas/testsuite/gas/riscv/smrnmi-noarch.l | 2 ++ gas/testsuite/gas/riscv/smrnmi.d | 10 ++++++++++ gas/testsuite/gas/riscv/smrnmi.s | 2 ++ include/opcode/riscv-opc.h | 15 +++++++++++++++ include/opcode/riscv.h | 1 + opcodes/riscv-opc.c | 3 +++ 20 files changed, 157 insertions(+) create mode 100644 gas/testsuite/gas/riscv/smrnmi-noarch.d create mode 100644 gas/testsuite/gas/riscv/smrnmi-noarch.l create mode 100644 gas/testsuite/gas/riscv/smrnmi.d create mode 100644 gas/testsuite/gas/riscv/smrnmi.s base-commit: 318d3bda5cad124bd11eebb0349d0f183ba625b1