diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 378704175..d198010dc 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -5193,6 +5193,9 @@ int riscv_init_registers(struct target *target) case CSR_VLENB: r->exist = (info->vlenb > 0); break; + case CSR_MCOUNTEREN: + r->exist = riscv_supports_extension(target, 'U'); + break; } if (!r->exist && !list_empty(&info->expose_csr)) {