aboutsummaryrefslogtreecommitdiff
path: root/riscv/extension.cc
blob: 5321c42c17d96b5f7a985716f36691cc1215ecb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// See LICENSE for license details.

#include "extension.h"
#include "trap.h"

extension_t::~extension_t()
{
}

void extension_t::illegal_instruction()
{
  throw trap_illegal_instruction();
}

void extension_t::raise_interrupt()
{
  reg_t prv = p->get_state()->prv;
  reg_t mie = get_field(p->get_state()->mstatus, MSTATUS_MIE);

  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!");
}

void extension_t::clear_interrupt()
{
}