mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
RISC-V: Add support for the Zicsr extension
The various CSR instructions have been split out of the base ISA as part of the ratification process. This patch adds a Zicsr argument, which disables all the CSR instructions. Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
50fba816cd
commit
591bddea8d
3 changed files with 8 additions and 0 deletions
|
@ -793,6 +793,7 @@ int riscv_csrrw(CPURISCVState *env, int csrno, target_ulong *ret_value,
|
|||
{
|
||||
int ret;
|
||||
target_ulong old_value;
|
||||
RISCVCPU *cpu = env_archcpu(env);
|
||||
|
||||
/* check privileges and return -1 if check fails */
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
|
@ -803,6 +804,11 @@ int riscv_csrrw(CPURISCVState *env, int csrno, target_ulong *ret_value,
|
|||
}
|
||||
#endif
|
||||
|
||||
/* ensure the CSR extension is enabled. */
|
||||
if (!cpu->cfg.ext_icsr) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check predicate */
|
||||
if (!csr_ops[csrno].predicate || csr_ops[csrno].predicate(env, csrno) < 0) {
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue