-
Notifications
You must be signed in to change notification settings - Fork 1
riscv_fix_csr_imply_on_priv
- Status: Merged for Binutils 2.40
- Branch:
riscv-fix-csr-imply-on-priv
- Tracking PR: #49 (view Pull Request and Diff)
- Mailing List:
- RFC PATCH v1 (2022-10-08)
-
RISC-V: Fix CSR accessibility and implications
This is a subset.
Quoting RISC-V Instruction Set Manual Volume II: Privileged Architecture,
...
The privileged architecture requires the
Zicsr
extension; which other privileged instructions are required depends on the privileged-architecture feature set.
So, if we use the privileged architecture, we should imply Zicsr
. You may wonder why I'm insisting so when seemingly different terms "depend" and "imply" are used. There's two reasons for that.
- We already handle those terms "depend" and "imply" equivalently
(like inF
→Zicsr
andD
→F
) - Quoting Andrew (https://github.com/riscv/riscv-isa-manual/pull/838#issuecomment-1107473631),
In this context, I view “require” and “imply” as equivalent, meaning that e.g. RV32IV and RV32IDV and RV32IFDV are all equivalent.
The problem here is, we don't have a "direct" way to represent dependency to the privileged architecture itself.
As a workaround, we should add implications from privileged extensions that either add new CSRs, extend existing CSRs or depends on using CSRs.
For ISA strings with those extensions, we can safely assume that we depend on the privileged architecture (and indirectly, the Zicsr
extension).
This patch adds implications for existing privileged extensions:
H
Smstateen
Sscofpmf
Sstc
Smepmp