[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/18] target/riscv: Simplify {read, write}_pmpcfg() a little bit
From: |
Bin Meng |
Subject: |
[PATCH 07/18] target/riscv: Simplify {read, write}_pmpcfg() a little bit |
Date: |
Tue, 14 Feb 2023 02:02:03 +0800 |
Use the register index that has already been calculated in the
pmpcfg_csr_{read,write} call.
Signed-off-by: Bin Meng <bmeng@tinylab.org>
---
target/riscv/csr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 8bbc75cbfa..da3b770894 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -3363,7 +3363,7 @@ static RISCVException read_pmpcfg(CPURISCVState *env, int
csrno,
if (!check_pmp_reg_index(env, reg_index)) {
return RISCV_EXCP_ILLEGAL_INST;
}
- *val = pmpcfg_csr_read(env, csrno - CSR_PMPCFG0);
+ *val = pmpcfg_csr_read(env, reg_index);
return RISCV_EXCP_NONE;
}
@@ -3375,7 +3375,7 @@ static RISCVException write_pmpcfg(CPURISCVState *env,
int csrno,
if (!check_pmp_reg_index(env, reg_index)) {
return RISCV_EXCP_ILLEGAL_INST;
}
- pmpcfg_csr_write(env, csrno - CSR_PMPCFG0, val);
+ pmpcfg_csr_write(env, reg_index, val);
return RISCV_EXCP_NONE;
}
--
2.25.1
- Re: [PATCH 05/18] target/riscv: Coding style fixes in csr.c, (continued)
- [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, 2023/02/13
- [PATCH 07/18] target/riscv: Simplify {read, write}_pmpcfg() a little bit,
Bin Meng <=
- [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
- [PATCH 09/18] target/riscv: Avoid reporting odd-numbered pmpcfgX in the CSR XML for RV64, Bin Meng, 2023/02/13