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 10:27:16 +0300
commitb346ba5889bcfd59c8dbd3c79c16015d9154cdd3 (patch)
treebdc3d2d52fd136c690560b5e3b168692b336203a
parente834aa7a8ff5d219057c8b427e7f3b132ae6008b (diff)
downloadqemu-b346ba5889bcfd59c8dbd3c79c16015d9154cdd3.tar.gz
qemu-b346ba5889bcfd59c8dbd3c79c16015d9154cdd3.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;