WIP on priv spec v1.9
[riscv-isa-sim.git] / riscv / extension.cc
index 00cd24ff9bd174daf33b4c4e92bcf83649dfec19..5321c42c17d96b5f7a985716f36691cc1215ecb2 100644 (file)
@@ -14,12 +14,11 @@ void extension_t::illegal_instruction()
 
 void extension_t::raise_interrupt()
 {
-  int priv = get_field(p->get_state()->mstatus, MSTATUS_PRV);
-  int ie = get_field(p->get_state()->mstatus, MSTATUS_IE);
+  reg_t prv = p->get_state()->prv;
+  reg_t mie = get_field(p->get_state()->mstatus, MSTATUS_MIE);
 
-  if (priv < PRV_M || (priv == PRV_M && ie)) {
+  if (prv < PRV_M || (prv == PRV_M && mie))
     p->raise_interrupt(IRQ_COP);
-  }
 
   throw std::logic_error("a COP exception was posted, but interrupts are disabled!");
 }