diff options
author | Bastian Koppelmann <kbastian@mail.uni-paderborn.de> | 2018-11-08 13:06:28 +0100 |
---|---|---|
committer | Palmer Dabbelt <palmer@sifive.com> | 2018-11-13 15:12:15 -0800 |
commit | 657377730647c2156f1e20087e28129dc32e1242 (patch) | |
tree | e702ad0eb6c27c009c5666804e0cb529c6bc010a /target | |
parent | 40cf6a54c92c475cb2f575561fe67044904c16b7 (diff) | |
download | qemu-657377730647c2156f1e20087e28129dc32e1242.zip qemu-657377730647c2156f1e20087e28129dc32e1242.tar.gz qemu-657377730647c2156f1e20087e28129dc32e1242.tar.bz2 |
target/riscv: Fix sfence.vm/a both available in any priv version
sfence.vm has been replaced in priv v1.10 spec by sfence.vma.
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'target')
-rw-r--r-- | target/riscv/translate.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 5359088..f44eb9c 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1292,10 +1292,14 @@ static void gen_system(CPURISCVState *env, DisasContext *ctx, uint32_t opc, #ifndef CONFIG_USER_ONLY /* Extract funct7 value and check whether it matches SFENCE.VMA */ if ((opc == OPC_RISC_ECALL) && ((csr >> 5) == 9)) { - /* sfence.vma */ - /* TODO: handle ASID specific fences */ - gen_helper_tlb_flush(cpu_env); - return; + if (env->priv_ver == PRIV_VERSION_1_10_0) { + /* sfence.vma */ + /* TODO: handle ASID specific fences */ + gen_helper_tlb_flush(cpu_env); + return; + } else { + gen_exception_illegal(ctx); + } } #endif @@ -1342,7 +1346,11 @@ static void gen_system(CPURISCVState *env, DisasContext *ctx, uint32_t opc, gen_helper_wfi(cpu_env); break; case 0x104: /* SFENCE.VM */ - gen_helper_tlb_flush(cpu_env); + if (env->priv_ver <= PRIV_VERSION_1_09_1) { + gen_helper_tlb_flush(cpu_env); + } else { + gen_exception_illegal(ctx); + } break; #endif default: |