diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-04-06 11:00:56 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-04-06 11:01:16 -0700 |
commit | ee00503ebecb5f705c8d36c0325ae12afb66a10c (patch) | |
tree | 7f557de194ff83899d7d98ba36f7a1418bff7af4 /pk/handlers.c | |
parent | 0eface07b9c2a565b2fcf95fff3fc755811bfb4e (diff) | |
download | riscv-pk-ee00503ebecb5f705c8d36c0325ae12afb66a10c.zip riscv-pk-ee00503ebecb5f705c8d36c0325ae12afb66a10c.tar.gz riscv-pk-ee00503ebecb5f705c8d36c0325ae12afb66a10c.tar.bz2 |
Don't assume existence of uarch counters
Diffstat (limited to 'pk/handlers.c')
-rw-r--r-- | pk/handlers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pk/handlers.c b/pk/handlers.c index 1961852..71466b8 100644 --- a/pk/handlers.c +++ b/pk/handlers.c @@ -14,6 +14,13 @@ static void handle_illegal_instruction(trapframe_t* tf) else kassert(len == 2); + // supply 0 for unimplemented uarch counters + if ((tf->insn & (MASK_CSRRS | 0xcc0U<<20)) == (MATCH_CSRRS | 0xcc0U<<20)) { + tf->gpr[(tf->insn >> 7) & 0x1f] = 0; + tf->epc += 4; + return; + } + dump_tf(tf); panic("An illegal instruction was executed!"); } |