@samitouri / QOSamiQemu / commits / d610e55c83

disas/riscv: Fix isa decoding of rev8

The encoding of rev8 is different for rv32 and rv64. Cc: qemu-stable@nongnu.org Fixes: 02c1b569a15 ("disas/riscv: Add Zb[abcs] instructions") Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-ID: <20260812223142.349142-40-richard.henderson@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Richard Henderson committed Aug 12, 2026 at 15:31 UTC d610e55c8390a8bfd15d0a4f1521d7fc46e4e0b7
1 file changed +10 -2
disas/riscv.c
+10 -2
@@ -3292,8 +3292,16 @@ static const rv_opcode_data *decode_inst_opcode(rv_decode *dec, rv_isa isa)
3292 case 0b01100: op = rv_op_rori; break;
3293 case 0b01101:
3294 switch ((inst >> 20) & 0b1111111) {
3295 - case 0b0011000: op = rv_op_rev8; break;
3296 - case 0b0111000: op = rv_op_rev8; break;
3295 + case 0b0011000:
3296 + if (isa == rv32) {
3297 + op = rv_op_rev8;
3298 + }
3299 + break;
3300 + case 0b0111000:
3301 + if (isa == rv64) {
3302 + op = rv_op_rev8;
3303 + }
3304 + break;
3305 case 0b0000111: op = rv_op_brev8; break;
3306 }
3307 break;