CSR_MCOUNTEREN should not exist if U-mode is not supported

Change-Id: I1a2420fb88bd3ee37f6a539992e8dc119fdd6e0e
This commit is contained in:
Parshintsev Anatoly 2023-02-10 02:08:40 +03:00
parent 9c3a4b458c
commit 5845f3b71c
1 changed files with 3 additions and 0 deletions

View File

@ -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)) {