bugfix in raising accelerator interrupts
[riscv-isa-sim.git] / riscv / extension.cc
1 #include "extension.h"
2 #include "trap.h"
3
4 extension_t::~extension_t()
5 {
6 }
7
8 void extension_t::illegal_instruction()
9 {
10 throw trap_illegal_instruction();
11 }
12
13 void extension_t::raise_interrupt()
14 {
15 int priv = get_field(p->get_state()->mstatus, MSTATUS_PRV);
16 int ie = get_field(p->get_state()->mstatus, MSTATUS_IE);
17
18 if (priv < PRV_M || (priv == PRV_M && ie)) {
19 p->raise_interrupt(IRQ_COP);
20 }
21
22 throw std::logic_error("a COP exception was posted, but interrupts are disabled!");
23 }
24
25 void extension_t::clear_interrupt()
26 {
27 }