]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
tcg/aarch64: Fix illegal insn from out-of-range shli
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 2 Jun 2022 01:04:30 +0000 (01:04 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Thu, 2 Jun 2022 15:09:46 +0000 (08:09 -0700)
The masking in tcg_out_shl was incorrect, producing an
illegal instruction, rather than merely unspecified results
for the out-of-range shift.

Tested-by: Joel Stanley <joel@jms.id.au>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1051
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/aarch64/tcg-target.c.inc

index 61e284bb5ca8ec1502fcf38eee84e831d6ce2be3..d997f7922aa33430dfe16d4e93110307f39760ed 100644 (file)
@@ -1261,7 +1261,7 @@ static inline void tcg_out_shl(TCGContext *s, TCGType ext,
 {
     int bits = ext ? 64 : 32;
     int max = bits - 1;
-    tcg_out_ubfm(s, ext, rd, rn, bits - (m & max), max - (m & max));
+    tcg_out_ubfm(s, ext, rd, rn, (bits - m) & max, (max - m) & max);
 }
 
 static inline void tcg_out_shr(TCGContext *s, TCGType ext,