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

Palmer Dabbelt via binutils binutils@sourceware.org
Mon Dec 2 23:16:00 GMT 2019


On Sun, 24 Nov 2019 23:40:08 PST (-0800), nelson.chu@sifive.com wrote:
>
> 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.

Looks like this has a conflict with the recent GDB changes to allow CSRs in
debug info and the patch set no longer applies.  Do you mind re-spinning it?



More information about the Binutils mailing list