Browse Source

Fix bug where CSRW to vsstatus would not set SD correctly (#665)

The priv spec says: "For example, the value of the HS-level sstatus.FS
[aka mstatus.FS] does not affect vsstatus.SD."
pull/669/head
Scott Johnson 6 years ago
committed by GitHub
parent
commit
0cd5a8bf3b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      riscv/processor.cc

2
riscv/processor.cc

@ -1209,7 +1209,7 @@ void processor_t::set_csr(int which, reg_t val)
mask |= (supports_extension('V') ? SSTATUS_VS : 0);
state.vsstatus = (state.vsstatus & ~mask) | (val & mask);
state.vsstatus &= (xlen == 64 ? ~SSTATUS64_SD : ~SSTATUS32_SD);
if (((state.mstatus & SSTATUS_FS) == SSTATUS_FS) ||
if (((state.vsstatus & SSTATUS_FS) == SSTATUS_FS) ||
((state.vsstatus & SSTATUS_VS) == SSTATUS_VS) ||
((state.vsstatus & SSTATUS_XS) == SSTATUS_XS)) {
state.vsstatus |= (xlen == 64 ? SSTATUS64_SD : SSTATUS32_SD);

Loading…
Cancel
Save