Merge pull request #230 from riscv/deleg

Make m*deleg regs conditional on U/S/N
riscv-compliance-dev
Tim Newsome 2018-03-30 14:02:13 -07:00 committed by GitHub
commit 3c7c7e26a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -2343,6 +2343,14 @@ int riscv_init_registers(struct target *target)
case CSR_SATP:
r->exist = riscv_supports_extension(target, 'S');
break;
case CSR_MEDELEG:
case CSR_MIDELEG:
/* "In systems with only M-mode, or with both M-mode and
* U-mode but without U-mode trap support, the medeleg and
* mideleg registers should not exist." */
r->exist = riscv_supports_extension(target, 'S') ||
riscv_supports_extension(target, 'N');
break;
}
if (!r->exist && expose_csr) {