From patchwork Tue Nov 29 01:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsukasa OI X-Patchwork-Id: 2342 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp55451wrr; Mon, 28 Nov 2022 17:23:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4fT8SPmh49Il948M0FwC9+2BcqX8aenqQrmZvf1KYPC4jmHO5dcywwUhsyWOa3MPGzp3mz X-Received: by 2002:a05:6402:1013:b0:463:f3a:32ce with SMTP id c19-20020a056402101300b004630f3a32cemr34029592edu.366.1669684989578; Mon, 28 Nov 2022 17:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669684989; cv=none; d=google.com; s=arc-20160816; b=QrEsQ9CdCEH62w7xs7LYsuMpqXwCrGEpNhKqadcXgrLW072f5iy3oJGkAhaS3kUfno FxjFhtfHaZv2hSXs91TLf04OC3Vu6lCBHAMsHrE1dlK9jYG9K/gTxHog5u9Vv1YLTYmz UJk1FVPuorTGi1nlJAFD7vRNUcrJi41ARNfWtnpAUc21I0ROWfYo2PaQK4LkycdY93Kr uY8R1QC5YUs7l/TXVdWCkoGcDaJYuClxDMZ8IkOk7mRPyvxqfy4tLWjNOTdzkhNQKAlc mPq4Lk6ncGtVmro4QKiNtVINqP8E3QumTHDHBnV5FIr/BLj92F+UN1ke88NF+6WFmeHV +42w== 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=yJYROxBTUx7OB4KShO0WPzBMZEUiTvF96ezwzU3z7Fg=; b=UR3S8GTa1HuttRHlP7VmDEgbSwhr7m1o78FiGApMrSRNQ7ZOy7oiwSHX1v+vtGrzfp 0BPEaYkp8s0qvkqrMm1Lf0xgW3RCaoatHh/pxa+tvr1VSOxArP3CubPVky0Bj1dIuYv8 oSojg5NjhXZy4mUA5/5VmhICHID3wR2I1DIVlSdLYirpjQtVf9fb80SmBbzOT/+7kOdZ hnhRRl6qwA9e6oyIgWvUJ1kUfPnW1W9Yg9lVTfKRAFBY3oM1y0JsEF3g9xFN3ciMHfcs tR8z9+Kls7iPW1uYCwlJGydWHI4iHa1TmtOQCCKCRIicqoQ9VbVT9WZnjE2NQPAGEpWY bD1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="T+Z7/ZpS"; 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 sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id cw4-20020a170906478400b0078e063fc78csi11726533ejc.576.2022.11.28.17.23.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Nov 2022 17:23:09 -0800 (PST) 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="T+Z7/ZpS"; 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 80E1F38460BC for ; Tue, 29 Nov 2022 01:22:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 80E1F38460BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669684926; bh=yJYROxBTUx7OB4KShO0WPzBMZEUiTvF96ezwzU3z7Fg=; 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=T+Z7/ZpSqjQbHoVCi+JO2HZ1MVadLx5k6RUlhwi51lRtu0qfVcKHqd7aN293gxPZF BiWah34+OvNLMkWfpB7oFemxcsSGWLfjadTT4sAHUXM3NU5dk0+eX59TSl0FHnAVTY +6yKGtLGccqqCnyTRlBdx75mSedMJcqMvVlFf8uE= 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 4DD1B384EF6C for ; Tue, 29 Nov 2022 01:21:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4DD1B384EF6C Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id B3F86300089; Tue, 29 Nov 2022 01:21:55 +0000 (UTC) To: Tsukasa OI Cc: binutils@sourceware.org Subject: [REVIEW ONLY 0/1] RISC-V (unratified): Add 'Smrnmi' extension Date: Tue, 29 Nov 2022 01:21:50 +0000 Message-Id: In-Reply-To: References: Mime-Version: 1.0 X-Spam-Status: No, score=-6.1 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.29 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750791607648411779?= X-GMAIL-MSGID: =?utf-8?q?1750791607648411779?= *** 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 v2 to keep track with latest GNU Binutils. In this version, a dependency to 'Zicsr' is added. 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 | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p11.d | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p11.l | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p12.d | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p12.l | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p9p1.d | 8 ++++++++ gas/testsuite/gas/riscv/csr-version-1p9p1.l | 8 ++++++++ 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, 125 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: cb44f89ce977b1ab2d4063f2487950bddfb75bc7