Make SIP.STIP read-only
authorAndrew Waterman <andrew@sifive.com>
Sun, 8 Jan 2017 01:56:22 +0000 (17:56 -0800)
committerAndrew Waterman <andrew@sifive.com>
Sun, 8 Jan 2017 01:56:22 +0000 (17:56 -0800)
h/t Ron Minnich

See https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/JV-Hj3W5Kw8

riscv/processor.cc

index f3764ae1e276265a30298dbd83a627d914b2bf13..75f4002bea9535519952d9bec51f8c314d7772e3 100644 (file)
@@ -373,9 +373,10 @@ void processor_t::set_csr(int which, reg_t val)
                  | SSTATUS_XS | SSTATUS_PUM;
       return set_csr(CSR_MSTATUS, (state.mstatus & ~mask) | (val & mask));
     }
-    case CSR_SIP:
-      return set_csr(CSR_MIP,
-                     (state.mip & ~state.mideleg) | (val & state.mideleg));
+    case CSR_SIP: {
+      reg_t mask = MIP_SSIP;
+      return set_csr(CSR_MIP, (state.mip & ~mask) | (val & mask));
+    }
     case CSR_SIE:
       return set_csr(CSR_MIE,
                      (state.mie & ~state.mideleg) | (val & state.mideleg));