diff options
author | Michael Clark <mjc@sifive.com> | 2018-03-16 12:12:00 -0700 |
---|---|---|
committer | Michael Clark <mjc@sifive.com> | 2018-05-06 10:39:38 +1200 |
commit | 67185dad16284467dba9b6159f9ec9ec53689582 (patch) | |
tree | 6ee92a75ea5a597a8a33ffb6dc883679a4a57cf6 /target/riscv | |
parent | 33e3bc8d77b6ce95e622bdc0fce622d35b7ee56c (diff) | |
download | qemu-67185dad16284467dba9b6159f9ec9ec53689582.zip qemu-67185dad16284467dba9b6159f9ec9ec53689582.tar.gz qemu-67185dad16284467dba9b6159f9ec9ec53689582.tar.bz2 |
RISC-V: Clear mtval/stval on exceptions without info
mtval/stval must be set on all exceptions but zero is
a legal value if there is no exception specific info.
Placing the instruction bytes for illegal instruction
exceptions in mtval/stval is an optional feature and
is currently not supported by QEMU RISC-V.
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Alistair Francis <Alistair.Francis@wdc.com>
Signed-off-by: Michael Clark <mjc@sifive.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv')
-rw-r--r-- | target/riscv/helper.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/target/riscv/helper.c b/target/riscv/helper.c index 02cbcea..95889f2 100644 --- a/target/riscv/helper.c +++ b/target/riscv/helper.c @@ -466,6 +466,10 @@ void riscv_cpu_do_interrupt(CPUState *cs) ": badaddr 0x" TARGET_FMT_lx, env->mhartid, env->badaddr); } env->sbadaddr = env->badaddr; + } else { + /* otherwise we must clear sbadaddr/stval + * todo: support populating stval on illegal instructions */ + env->sbadaddr = 0; } target_ulong s = env->mstatus; @@ -487,6 +491,10 @@ void riscv_cpu_do_interrupt(CPUState *cs) ": badaddr 0x" TARGET_FMT_lx, env->mhartid, env->badaddr); } env->mbadaddr = env->badaddr; + } else { + /* otherwise we must clear mbadaddr/mtval + * todo: support populating mtval on illegal instructions */ + env->mbadaddr = 0; } target_ulong s = env->mstatus; |