aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/mfpcr.h
blob: 54c62edccfe80b0d496c696384233fdea20f4532 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require_supervisor;

reg_t val;

switch(insn.rtype.rs2)
{
  case 0:
    val = sr;
    break;
  case 1:
    val = epc;
    break;
  case 2:
    val = badvaddr;
    break;
  case 3:
    val = evec;
    break;
  case 4:
    val = count;
    break;
  case 5:
    val = compare;
    break;
  case 6:
    val = cause;
    break;

  case 8:
    val = MEMSIZE >> 12;
    break;

  case 17:
    fromhost = val = sim->get_fromhost();
    break;

  case 24:
    val = pcr_k0;
    break;
  case 25:
    val = pcr_k1;
    break;

  default:
    val = -1;
}

RD = gprlen == 64 ? val : sext32(val);