summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTANG Tiancheng <lyndra@linux.alibaba.com>2026-07-03 13:03:36 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2026-08-25 14:11:14 +0300
commite96613043293eac2e80dc2ce95ebecf058e65e47 (patch)
tree8ccf8f3b7440baa4b5ef5953853cfabf4458188a
parent63af2c074bd4cffb5ab3110c7e62f71f55002e34 (diff)
downloadqemu-e96613043293eac2e80dc2ce95ebecf058e65e47.tar.gz
qemu-e96613043293eac2e80dc2ce95ebecf058e65e47.zip
disas/riscv: Fix th.srri decoding
target/riscv/xthead.decode defines th.srri as funct6=000100 in bits 31:26, with the 6-bit immediate in bits 25:20. decode_xtheadbb() switches on bits 31:25, i.e. funct6 plus imm[5]. Therefore valid th.srri encodings are 0001000 and 0001001. The current 0000100 and 0000101 cases use the wrong funct6 value and decode valid th.srri instructions as illegal. Fix the cases to match funct6=000100 with both imm[5] values. Fixes: 318df7238b9f ("disas/riscv: Add support for XThead* instructions") Signed-off-by: TANG Tiancheng <lyndra@linux.alibaba.com> Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20260703-b4-disas-xthead-fix-riscv-next-v4-1-84c566330bc7@linux.alibaba.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com> (cherry picked from commit 6985cfc87512e96c0abfa7fffc836e7bd3889048) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--disas/riscv-xthead.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/disas/riscv-xthead.c b/disas/riscv-xthead.c
index fcca326d1c..2f2ddb8dd9 100644
--- a/disas/riscv-xthead.c
+++ b/disas/riscv-xthead.c
@@ -315,8 +315,10 @@ void decode_xtheadbb(rv_decode *dec, rv_isa isa)
op = rv_op_th_revw;
}
break;
- case 0b0000100:
- case 0b0000101: op = rv_op_th_srri; break;
+ case 0b0001000:
+ case 0b0001001:
+ op = rv_op_th_srri;
+ break;
}
break;
case 2: op = rv_op_th_ext; break;