This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/4] RISC-V: Support more rigorous check for CSR, and update them to spec 1.12.


According to the riscv privilege spec, CSR have some restrictions when we use
them.  Some of CSR are only valid when the specific extension is set.  Some of
CSR are read-only CSR, and we have no write access for them.  These for patches
are used to support more rigorous check for CSR, and the currently supported
checks are shown as follows:

* The ISA-dependent CSR checking
  - The CSR are only valid when the f extension is set.
  - The CSR are only valid for the rv32.

* The read-only CSR checking
  - CSRRW and CSRRWI always write CSR.  CSRRS, CSRRC, CSRRSI and CSRRCI write
    CSR when RS1 isn't zero.  We can not write the read-ony CSR by these CSR
    instructions.

For now, consider the CSR checking will cause some backwards incompatibilities,
we disable the CSR checking by default, and support two new .options
(.option csrcheck/nocsrcheck) and two new GAS options (-mcsrcheck/-mno-csrcheck)
to enbale/disable CSR checking if user need.

The previous patches are a lot hard to read, so I re-send them by the
git-send-email again.  These four patches are almost same as the previous
version.  But there are two places that are different.  One is that I remove
the redundant source files of testsuite in the second patch (priv-reg-fail-fext.s
and priv-reg-fail-rv32-only.s), and add one new testsuite for the CSR read-only
checking in the third patch (priv-reg-fail-readonly-01).  Another is that the
previous third patch has an error in the riscv_csr_read_only_check (readonly).
I have fixed it in the newest patch.

Thanks and regards
Nelson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]