projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a7e407b
)
target/riscv: Simplify {read, write}_pmpcfg() a little bit
author
Bin Meng
<bmeng@tinylab.org>
Tue, 28 Feb 2023 10:40:24 +0000
(18:40 +0800)
committer
Palmer Dabbelt
<palmer@rivosinc.com>
Thu, 2 Mar 2023 00:40:16 +0000
(16:40 -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>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <
20230228104035
.
1879882
-9-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
target/riscv/csr.c
patch
|
blob
|
history
diff --git
a/target/riscv/csr.c
b/target/riscv/csr.c
index 9264db611052b389d9cb371b866530b9254d806a..a3e0e5755cdf749d9a9371a322add665068b5f57 100644
(file)
--- a/
target/riscv/csr.c
+++ b/
target/riscv/csr.c
@@
-3360,7
+3360,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;
}
@@
-3372,7
+3372,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;
}