Make IRQ_COP read-only/undelegable unless coprocessor is present
authorAndrew Waterman <andrew@sifive.com>
Wed, 22 Aug 2018 21:07:45 +0000 (14:07 -0700)
committerAndrew Waterman <andrew@sifive.com>
Wed, 22 Aug 2018 21:07:45 +0000 (14:07 -0700)
riscv/processor.cc

index 8bcd8e2cc9dfcf4e0cca5c4fe2d0c5f093815083..4a7d0ec6147a8c58be756faf914b4b4ab6732fbe 100644 (file)
@@ -330,7 +330,8 @@ int processor_t::paddr_bits()
 void processor_t::set_csr(int which, reg_t val)
 {
   val = zext_xlen(val);
-  reg_t delegable_ints = MIP_SSIP | MIP_STIP | MIP_SEIP | (1 << IRQ_COP);
+  reg_t delegable_ints = MIP_SSIP | MIP_STIP | MIP_SEIP
+                       | ((ext != NULL) << IRQ_COP);
   reg_t all_ints = delegable_ints | MIP_MSIP | MIP_MTIP;
   switch (which)
   {