diff options
author | Yunsup Lee <yunsup@cs.berkeley.edu> | 2015-03-16 02:01:26 -0700 |
---|---|---|
committer | Yunsup Lee <yunsup@cs.berkeley.edu> | 2015-03-16 02:01:26 -0700 |
commit | c0f7d3cd7760f6021a87027a2bb95039daa92c4a (patch) | |
tree | ffebbce7633b5e9908fc9b5230bb5a83b5335aa6 /riscv/extension.cc | |
parent | 68d1d85208680ca335141916df0c54a4f03aace5 (diff) | |
download | spike-c0f7d3cd7760f6021a87027a2bb95039daa92c4a.zip spike-c0f7d3cd7760f6021a87027a2bb95039daa92c4a.tar.gz spike-c0f7d3cd7760f6021a87027a2bb95039daa92c4a.tar.bz2 |
bugfix in raising accelerator interrupts
Diffstat (limited to 'riscv/extension.cc')
-rw-r--r-- | riscv/extension.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/riscv/extension.cc b/riscv/extension.cc index c2bea2e..0977139 100644 --- a/riscv/extension.cc +++ b/riscv/extension.cc @@ -12,7 +12,14 @@ void extension_t::illegal_instruction() void extension_t::raise_interrupt() { - p->raise_interrupt(IRQ_COP); + int priv = get_field(p->get_state()->mstatus, MSTATUS_PRV); + int ie = get_field(p->get_state()->mstatus, MSTATUS_IE); + + if (priv < PRV_M || (priv == PRV_M && ie)) { + p->raise_interrupt(IRQ_COP); + } + + throw std::logic_error("a COP exception was posted, but interrupts are disabled!"); } void extension_t::clear_interrupt() |