[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/18] target/riscv: Correct the priority policy of riscv_csrrw_c
From: |
Bin Meng |
Subject: |
[PATCH 02/18] target/riscv: Correct the priority policy of riscv_csrrw_check() |
Date: |
Tue, 14 Feb 2023 02:01:58 +0800 |
The priority policy of riscv_csrrw_check() was once adjusted in
commit eacaf4401956 ("target/riscv: Fix priority of csr related check in
riscv_csrrw_check")
whose commit message says the CSR existence check should come
before the access control check, but the code changes did not
agree with the commit message, that the predicate() check came
after the read / write check.
Fixes: eacaf4401956 ("target/riscv: Fix priority of csr related check in
riscv_csrrw_check")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
---
target/riscv/csr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 1b0a0c1693..c2dd9d5af0 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -3793,15 +3793,15 @@ static inline RISCVException
riscv_csrrw_check(CPURISCVState *env,
return RISCV_EXCP_ILLEGAL_INST;
}
- if (write_mask && read_only) {
- return RISCV_EXCP_ILLEGAL_INST;
- }
-
RISCVException ret = csr_ops[csrno].predicate(env, csrno);
if (ret != RISCV_EXCP_NONE) {
return ret;
}
+ if (write_mask && read_only) {
+ return RISCV_EXCP_ILLEGAL_INST;
+ }
+
#if !defined(CONFIG_USER_ONLY)
int csr_priv, effective_priv = env->priv;
--
2.25.1
- Re: [PATCH 03/18] target/riscv: gdbstub: Minor change for better readability, (continued)
- [PATCH 05/18] target/riscv: Coding style fixes in csr.c, Bin Meng, 2023/02/13
- [PATCH 06/18] target/riscv: Use 'bool' type for read_only, Bin Meng, 2023/02/13
- [PATCH 04/18] target/riscv: gdbstub: Do not generate CSR XML if Zicsr is disabled, Bin Meng, 2023/02/13
- [PATCH 02/18] target/riscv: Correct the priority policy of riscv_csrrw_check(),
Bin Meng <=
- [PATCH 07/18] target/riscv: Simplify {read, write}_pmpcfg() a little bit, Bin Meng, 2023/02/13
- [PATCH 10/18] target/riscv: gdbstub: Turn on debugger mode before calling CSR predicate(), Bin Meng, 2023/02/13
- [PATCH 08/18] target/riscv: Simplify getting RISCVCPU pointer from env, Bin Meng, 2023/02/13