diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2022-12-03 11:57:44 -0600 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2023-01-06 10:42:55 +1000 |
commit | ec2918b467228e7634f1dd5f35033ad3021b6ef7 (patch) | |
tree | 9e06b632800493528c5af5d7217338ec182c9571 /target/riscv | |
parent | 4c48aad122b9dd4d96184828d7172cc62dae01c5 (diff) | |
download | qemu-ec2918b467228e7634f1dd5f35033ad3021b6ef7.zip qemu-ec2918b467228e7634f1dd5f35033ad3021b6ef7.tar.gz qemu-ec2918b467228e7634f1dd5f35033ad3021b6ef7.tar.bz2 |
target/riscv: Set pc_succ_insn for !rvc illegal insn
Failure to set pc_succ_insn may result in a TB covering zero bytes,
which triggers an assert within the code generator.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1224
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20221203175744.151365-1-richard.henderson@linaro.org>
[ Changes by AF:
- Add missing run-plugin-test-noc-% line
]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'target/riscv')
-rw-r--r-- | target/riscv/translate.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/target/riscv/translate.c b/target/riscv/translate.c index cd5eb25..160aefc 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -1096,14 +1096,10 @@ static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode) ctx->virt_inst_excp = false; /* Check for compressed insn */ if (insn_len(opcode) == 2) { - if (!has_ext(ctx, RVC)) { - gen_exception_illegal(ctx); - } else { - ctx->opcode = opcode; - ctx->pc_succ_insn = ctx->base.pc_next + 2; - if (decode_insn16(ctx, opcode)) { - return; - } + ctx->opcode = opcode; + ctx->pc_succ_insn = ctx->base.pc_next + 2; + if (has_ext(ctx, RVC) && decode_insn16(ctx, opcode)) { + return; } } else { uint32_t opcode32 = opcode; |