From 6d5a351a9833cf7555e6b91019c481b9e55b47bf Mon Sep 17 00:00:00 2001 From: Scott Johnson Date: Sun, 7 Mar 2021 17:16:20 -0800 Subject: [PATCH] Forbid `csrw vsstatus` from modifying the UXL field (#671) Since this is not modifiable in the real sstatus, so it should not be in the virtualized version either. --- riscv/processor.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/riscv/processor.cc b/riscv/processor.cc index 8abe552e..5b39d6fa 100644 --- a/riscv/processor.cc +++ b/riscv/processor.cc @@ -1189,6 +1189,7 @@ void processor_t::set_csr(int which, reg_t val) ((state.vsstatus & SSTATUS_XS) == SSTATUS_XS)) { state.vsstatus |= (xlen == 64 ? SSTATUS64_SD : SSTATUS32_SD); } + state.vsstatus = set_field(state.vsstatus, SSTATUS_UXL, xlen_to_uxl(max_xlen)); break; } case CSR_VSIE: {