Skip to content

Commit

Permalink
Merge pull request #1363 from YenHaoChen/pr-initial-mpp
Browse files Browse the repository at this point in the history
Let mstatus.MPP initially be M-mode if unsupporting U-mode
  • Loading branch information
aswaterman committed May 23, 2023
2 parents 8780656 + 4dfdf00 commit 23bc4cd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions riscv/csrs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ reg_t mstatus_csr_t::compute_mstatus_initial_value() const noexcept {
| (proc->extension_enabled_const('S') ? MSTATUS_SBE : 0)
| MSTATUS_MBE;
return 0
| set_field((reg_t)0, MSTATUS_MPP, proc->extension_enabled_const('U') ? PRV_U : PRV_M)
| (proc->extension_enabled_const('U') && (proc->get_const_xlen() != 32) ? set_field((reg_t)0, MSTATUS_UXL, xlen_to_uxl(proc->get_const_xlen())) : 0)
| (proc->extension_enabled_const('S') && (proc->get_const_xlen() != 32) ? set_field((reg_t)0, MSTATUS_SXL, xlen_to_uxl(proc->get_const_xlen())) : 0)
| (proc->get_mmu()->is_target_big_endian() ? big_endian_bits : 0)
Expand Down

0 comments on commit 23bc4cd

Please sign in to comment.