From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id D3C9A3858D37 for ; Fri, 4 Feb 2022 00:14:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D3C9A3858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-lf1-x12b.google.com with SMTP id o12so9343787lfg.12 for ; Thu, 03 Feb 2022 16:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nP1gyYTQp8s/u0q955KqM5Ua+9vmndiK+PgQSGzBTYw=; b=VLVVwrBkZ45aEE1bVQ0DeD/d61sJN4WQC2G6BCpXZ+8lTUOrSdVi0MbAi2w9l/aQEw cfCgYyPB0lKcEG5WYEjCXEkSketZGmOBUuMwhGMbG0d8zbLfmmZw+ibpMyw+d7NCpSvk HmqHLLIkOB6KVNgUzWhK556uACBCHtgdwphBt+0bnDEvix1O62trKAjrtWFSkdb0CyD/ h3UmCnJjJ684gBEGbonHxjpinXiJeqmFq4fyeBK47cIuysB4HM3Vaq/0bjPBzuZ01Ayv ItHMRu6KD6GLtXvcFdp9185e7A8Abq6lJe/1a4hHfJftAKxwG7mFcsPwRSEj7iJJoS95 ztCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nP1gyYTQp8s/u0q955KqM5Ua+9vmndiK+PgQSGzBTYw=; b=vo8L2h+xCCq01Qyq7qQ4di/FsN1R/qt6/lzf3eilFUJUHnAZ4/o2NJ11TF2PPfpTVa 6miT0uFd6dMANooJ3051JynHyt5SD6m/ep/bUY71NEsEQhx3HlElrPff3ib0GajdN7dZ eFiSUwVJi2LtWhZNbuufQhZkypLkdPROWywxGgFtsm9QYhkIeHZ76zxmXxp4r4IHhAxE Dlltb9uF8CXnecWSOnr1OxAmwUwsH1eMTHepIY3T32seOwsa7TBqId7VPGIcZNMJjGIV cDfo6JUApy0Q/QrZYczOKYrXksKbfg/n7Pe8Eu0yhZLLtDzPDac77/v756k2y+ejNbP1 h1Gw== X-Gm-Message-State: AOAM532r0DhqEp36gNByLMefsShF+A58a7WDsnE+WyzK6Va3VG+lnNuJ HErzzKniObreWgsurT8qnoQWvd0ENWkUvc9c X-Google-Smtp-Source: ABdhPJxAgTtP8ISxu+GzSy63Bm+JllWBvb5wBREz1Ev6Uo1bLOK1DqWG/reaBsdZk/ws3jCf805GVQ== X-Received: by 2002:ac2:5fa8:: with SMTP id s8mr501468lfe.150.1643933643930; Thu, 03 Feb 2022 16:14:03 -0800 (PST) Received: from ubuntu-focal.. ([2a01:4f9:3a:1e26::2]) by smtp.gmail.com with ESMTPSA id 8sm38137lfq.200.2022.02.03.16.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 16:14:03 -0800 (PST) From: Philipp Tomsich To: binutils@sourceware.org Cc: Kito Cheng , Paul Donahue , Nelson Chu , Vineet Gupta , Philipp Tomsich Subject: [PATCH v1] RISC-V: Add mtinst and mtval2 CSRs (defined in priv-spec 1.12) Date: Fri, 4 Feb 2022 01:13:58 +0100 Message-Id: <20220204001358.2810487-1-philipp.tomsich@vrull.eu> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Fri, 04 Feb 2022 00:14:09 -0000 The mtinst and mtval2 CSRs (defined in priv-spec 1.12) are currently unsupported and missing even when priv-spec is set to 1.12. Adding those together with their testcases. Signed-off-by: Philipp Tomsich gas/ChangeLog: * testsuite/gas/riscv/csr-dw-regnums.d: Add mtinst and mtval2. * testsuite/gas/riscv/csr-dw-regnums.s: Likewise. * testsuite/gas/riscv/csr-version-1p10.d: Likewise. * testsuite/gas/riscv/csr-version-1p10.l: Likewise. * testsuite/gas/riscv/csr-version-1p11.d: Likewise. * testsuite/gas/riscv/csr-version-1p11.l: Likewise. * testsuite/gas/riscv/csr-version-1p12.d: Likewise. * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise. * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise. * testsuite/gas/riscv/csr.s: Likewise. include/ChangeLog: * opcode/riscv-opc.h: Add mtinst and mtval2 CSRs (defined in priv-spec 1.12). --- gas/testsuite/gas/riscv/csr-dw-regnums.d | 4 +++- gas/testsuite/gas/riscv/csr-dw-regnums.s | 2 ++ gas/testsuite/gas/riscv/csr-version-1p10.d | 4 ++++ gas/testsuite/gas/riscv/csr-version-1p10.l | 4 ++++ gas/testsuite/gas/riscv/csr-version-1p11.d | 4 ++++ gas/testsuite/gas/riscv/csr-version-1p11.l | 4 ++++ gas/testsuite/gas/riscv/csr-version-1p12.d | 4 ++++ gas/testsuite/gas/riscv/csr-version-1p9p1.d | 4 ++++ gas/testsuite/gas/riscv/csr-version-1p9p1.l | 4 ++++ gas/testsuite/gas/riscv/csr.s | 2 ++ include/opcode/riscv-opc.h | 4 ++++ 11 files changed, 39 insertions(+), 1 deletion(-) diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d index ea0a445c39c..33c6c3c9153 100644 --- a/gas/testsuite/gas/riscv/csr-dw-regnums.d +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d @@ -1,4 +1,4 @@ -#as: -march=rv32if -mpriv-spec=1.11 +#as: -march=rv32if -mpriv-spec=1.12 #objdump: --dwarf=frames @@ -117,6 +117,8 @@ Contents of the .* section: DW_CFA_offset_extended_sf: r4930 \(mcause\) at cfa\+3336 DW_CFA_offset_extended_sf: r4931 \(mtval\) at cfa\+3340 DW_CFA_offset_extended_sf: r4932 \(mip\) at cfa\+3344 + DW_CFA_offset_extended_sf: r4938 \(mtinst\) at cfa\+3368 + DW_CFA_offset_extended_sf: r4939 \(mtval2\) at cfa\+3372 DW_CFA_offset_extended_sf: r5024 \(pmpcfg0\) at cfa\+3712 DW_CFA_offset_extended_sf: r5025 \(pmpcfg1\) at cfa\+3716 DW_CFA_offset_extended_sf: r5026 \(pmpcfg2\) at cfa\+3720 diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s index 549475d650e..ee9b03c8699 100644 --- a/gas/testsuite/gas/riscv/csr-dw-regnums.s +++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s @@ -107,6 +107,8 @@ _start: .cfi_offset mcause, 3336 .cfi_offset mtval, 3340 .cfi_offset mip, 3344 + .cfi_offset mtinst, 3368 + .cfi_offset mtval2, 3372 .cfi_offset pmpcfg0, 3712 .cfi_offset pmpcfg1, 3716 .cfi_offset pmpcfg2, 3720 diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d index 88da7240a78..51cc34c609d 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p10.d +++ b/gas/testsuite/gas/riscv/csr-version-1p10.d @@ -209,6 +209,10 @@ Disassembly of section .text: [ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mtval,a1 [ ]+[0-9a-f]+:[ ]+34402573[ ]+csrr[ ]+a0,mip [ ]+[0-9a-f]+:[ ]+34459073[ ]+csrw[ ]+mip,a1 +[ ]+[0-9a-f]+:[ ]+34a02573[ ]+csrr[ ]+a0,0x34a +[ ]+[0-9a-f]+:[ ]+34a59073[ ]+csrw[ ]+0x34a,a1 +[ ]+[0-9a-f]+:[ ]+34b02573[ ]+csrr[ ]+a0,0x34b +[ ]+[0-9a-f]+:[ ]+34b59073[ ]+csrw[ ]+0x34b,a1 [ ]+[0-9a-f]+:[ ]+3a002573[ ]+csrr[ ]+a0,pmpcfg0 [ ]+[0-9a-f]+:[ ]+3a059073[ ]+csrw[ ]+pmpcfg0,a1 [ ]+[0-9a-f]+:[ ]+3a102573[ ]+csrr[ ]+a0,pmpcfg1 diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l index ed6773e637c..61abcabef56 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p10.l +++ b/gas/testsuite/gas/riscv/csr-version-1p10.l @@ -131,6 +131,10 @@ .*Warning: read-only CSR is written `csrw marchid,a1' .*Warning: read-only CSR is written `csrw mimpid,a1' .*Warning: read-only CSR is written `csrw mhartid,a1' +.*Warning: invalid CSR `mtinst' for the privileged spec `1.10' +.*Warning: invalid CSR `mtinst' for the privileged spec `1.10' +.*Warning: invalid CSR `mtval2' for the privileged spec `1.10' +.*Warning: invalid CSR `mtval2' for the privileged spec `1.10' .*Warning: invalid CSR `pmpcfg1' for the current ISA .*Warning: invalid CSR `pmpcfg1' for the current ISA .*Warning: invalid CSR `pmpcfg3' for the current ISA diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d index b40c1d5d6b9..33bcf7abb55 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p11.d +++ b/gas/testsuite/gas/riscv/csr-version-1p11.d @@ -209,6 +209,10 @@ Disassembly of section .text: [ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mtval,a1 [ ]+[0-9a-f]+:[ ]+34402573[ ]+csrr[ ]+a0,mip [ ]+[0-9a-f]+:[ ]+34459073[ ]+csrw[ ]+mip,a1 +[ ]+[0-9a-f]+:[ ]+34a02573[ ]+csrr[ ]+a0,0x34a +[ ]+[0-9a-f]+:[ ]+34a59073[ ]+csrw[ ]+0x34a,a1 +[ ]+[0-9a-f]+:[ ]+34b02573[ ]+csrr[ ]+a0,0x34b +[ ]+[0-9a-f]+:[ ]+34b59073[ ]+csrw[ ]+0x34b,a1 [ ]+[0-9a-f]+:[ ]+3a002573[ ]+csrr[ ]+a0,pmpcfg0 [ ]+[0-9a-f]+:[ ]+3a059073[ ]+csrw[ ]+pmpcfg0,a1 [ ]+[0-9a-f]+:[ ]+3a102573[ ]+csrr[ ]+a0,pmpcfg1 diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l index 44d9611fe49..09db0bd457f 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p11.l +++ b/gas/testsuite/gas/riscv/csr-version-1p11.l @@ -131,6 +131,10 @@ .*Warning: read-only CSR is written `csrw marchid,a1' .*Warning: read-only CSR is written `csrw mimpid,a1' .*Warning: read-only CSR is written `csrw mhartid,a1' +.*Warning: invalid CSR `mtinst' for the privileged spec `1.11' +.*Warning: invalid CSR `mtinst' for the privileged spec `1.11' +.*Warning: invalid CSR `mtval2' for the privileged spec `1.11' +.*Warning: invalid CSR `mtval2' for the privileged spec `1.11' .*Warning: invalid CSR `pmpcfg1' for the current ISA .*Warning: invalid CSR `pmpcfg1' for the current ISA .*Warning: invalid CSR `pmpcfg3' for the current ISA diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d index fbc30ee2fcc..ec19bab5550 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p12.d +++ b/gas/testsuite/gas/riscv/csr-version-1p12.d @@ -209,6 +209,10 @@ Disassembly of section .text: [ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mtval,a1 [ ]+[0-9a-f]+:[ ]+34402573[ ]+csrr[ ]+a0,mip [ ]+[0-9a-f]+:[ ]+34459073[ ]+csrw[ ]+mip,a1 +[ ]+[0-9a-f]+:[ ]+34a02573[ ]+csrr[ ]+a0,mtinst +[ ]+[0-9a-f]+:[ ]+34a59073[ ]+csrw[ ]+mtinst,a1 +[ ]+[0-9a-f]+:[ ]+34b02573[ ]+csrr[ ]+a0,mtval2 +[ ]+[0-9a-f]+:[ ]+34b59073[ ]+csrw[ ]+mtval2,a1 [ ]+[0-9a-f]+:[ ]+3a002573[ ]+csrr[ ]+a0,pmpcfg0 [ ]+[0-9a-f]+:[ ]+3a059073[ ]+csrw[ ]+pmpcfg0,a1 [ ]+[0-9a-f]+:[ ]+3a102573[ ]+csrr[ ]+a0,pmpcfg1 diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d index a96e8c9dbec..46bc465f8f7 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d @@ -209,6 +209,10 @@ Disassembly of section .text: [ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mbadaddr,a1 [ ]+[0-9a-f]+:[ ]+34402573[ ]+csrr[ ]+a0,mip [ ]+[0-9a-f]+:[ ]+34459073[ ]+csrw[ ]+mip,a1 +[ ]+[0-9a-f]+:[ ]+34a02573[ ]+csrr[ ]+a0,0x34a +[ ]+[0-9a-f]+:[ ]+34a59073[ ]+csrw[ ]+0x34a,a1 +[ ]+[0-9a-f]+:[ ]+34b02573[ ]+csrr[ ]+a0,0x34b +[ ]+[0-9a-f]+:[ ]+34b59073[ ]+csrw[ ]+0x34b,a1 [ ]+[0-9a-f]+:[ ]+3a002573[ ]+csrr[ ]+a0,0x3a0 [ ]+[0-9a-f]+:[ ]+3a059073[ ]+csrw[ ]+0x3a0,a1 [ ]+[0-9a-f]+:[ ]+3a102573[ ]+csrr[ ]+a0,0x3a1 diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l index 00d46f509de..ac505eae3f8 100644 --- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l +++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l @@ -143,6 +143,10 @@ .*Warning: invalid CSR `mcounteren' for the privileged spec `1.9.1' .*Warning: invalid CSR `mtval' for the privileged spec `1.9.1' .*Warning: invalid CSR `mtval' for the privileged spec `1.9.1' +.*Warning: invalid CSR `mtinst' for the privileged spec `1.9.1' +.*Warning: invalid CSR `mtinst' for the privileged spec `1.9.1' +.*Warning: invalid CSR `mtval2' for the privileged spec `1.9.1' +.*Warning: invalid CSR `mtval2' for the privileged spec `1.9.1' .*Warning: invalid CSR `pmpcfg0' for the privileged spec `1.9.1' .*Warning: invalid CSR `pmpcfg0' for the privileged spec `1.9.1' .*Warning: invalid CSR `pmpcfg1' for the current ISA diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s index 568328d70d9..423d97ba37c 100644 --- a/gas/testsuite/gas/riscv/csr.s +++ b/gas/testsuite/gas/riscv/csr.s @@ -122,6 +122,8 @@ csr mcause csr mtval # Added in 1.10 csr mip + csr mtinst # Added in 1.12 + csr mtval2 # Added in 1.12 # Machine Memory Protection csr pmpcfg0 # Added in 1.10 diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h index cc5287f9872..c9b69f151ec 100644 --- a/include/opcode/riscv-opc.h +++ b/include/opcode/riscv-opc.h @@ -2156,6 +2156,8 @@ #define CSR_MCAUSE 0x342 #define CSR_MTVAL 0x343 #define CSR_MIP 0x344 +#define CSR_MTINST 0x34A +#define CSR_MTVAL2 0x34B #define CSR_PMPCFG0 0x3a0 #define CSR_PMPCFG1 0x3a1 #define CSR_PMPCFG2 0x3a2 @@ -2773,6 +2775,8 @@ DECLARE_CSR(mepc, CSR_MEPC, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_ DECLARE_CSR(mcause, CSR_MCAUSE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT) DECLARE_CSR(mtval, CSR_MTVAL, CSR_CLASS_I, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT) DECLARE_CSR(mip, CSR_MIP, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_DRAFT) +DECLARE_CSR(mtinst, CSR_MTINST, CSR_CLASS_I, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT) +DECLARE_CSR(mtval2, CSR_MTVAL2, CSR_CLASS_I, PRIV_SPEC_CLASS_1P12, PRIV_SPEC_CLASS_DRAFT) DECLARE_CSR(pmpcfg0, CSR_PMPCFG0, CSR_CLASS_I, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT) DECLARE_CSR(pmpcfg1, CSR_PMPCFG1, CSR_CLASS_I_32, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT) DECLARE_CSR(pmpcfg2, CSR_PMPCFG2, CSR_CLASS_I, PRIV_SPEC_CLASS_1P10, PRIV_SPEC_CLASS_DRAFT) -- 2.34.1