Browse Source
Merge pull request #2216 from pointerliu/fix-tw-read
csrs.cc: if no U-mode, mstatus.tw is read-only 0
pull/2218/head
Andrew Waterman
7 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
1 deletions
-
riscv/csrs.cc
|
|
|
@ -556,7 +556,8 @@ bool mstatus_csr_t::unlogged_write(const reg_t val) noexcept { |
|
|
|
const reg_t mask = adj_write_mask |
|
|
|
| MSTATUS_MIE | MSTATUS_MPIE |
|
|
|
| (proc->extension_enabled('U') ? MSTATUS_MPRV : 0) |
|
|
|
| MSTATUS_MPP | MSTATUS_TW |
|
|
|
| MSTATUS_MPP |
|
|
|
| (proc->extension_enabled('U') ? MSTATUS_TW : 0) |
|
|
|
| (proc->extension_enabled('S') ? MSTATUS_TSR : 0) |
|
|
|
| (has_page ? MSTATUS_TVM : 0) |
|
|
|
| (has_gva ? MSTATUS_GVA : 0) |
|
|
|
|