[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/13] tcg/i386: fix vector operations on 32-bit host
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 13/13] tcg/i386: fix vector operations on 32-bit hosts |
Date: |
Wed, 26 Sep 2018 11:37:09 -0700 |
From: Roman Kapl <address@hidden>
The TCG backend uses LOWREGMASK to get the low 3 bits of register numbers.
This was defined as no-op for 32-bit x86, with the assumption that we have
eight registers anyway. This assumption is not true once we have xmm regs.
Since LOWREGMASK was a no-op, xmm register indidices were wrong in opcodes
and have overflown into other opcode fields, wreaking havoc.
To trigger these problems, you can try running the "movi d8, #0x0" AArch64
instruction on 32-bit x86. "vpxor %xmm0, %xmm0, %xmm0" should be generated,
but instead TCG generated "vpxor %xmm0, %xmm0, %xmm2".
Fixes: 770c2fc7bb ("Add vector operations")
Signed-off-by: Roman Kapl <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/i386/tcg-target.inc.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index a91e4f1313..436195894b 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -302,11 +302,7 @@ static inline int tcg_target_const_match(tcg_target_long
val, TCGType type,
return 0;
}
-#if TCG_TARGET_REG_BITS == 64
# define LOWREGMASK(x) ((x) & 7)
-#else
-# define LOWREGMASK(x) (x)
-#endif
#define P_EXT 0x100 /* 0x0f opcode prefix */
#define P_EXT38 0x200 /* 0x0f 0x38 opcode prefix */
--
2.17.1
- [Qemu-devel] [PULL 00/13] tcg-next patch queue, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 01/13] qht: remove unused map param from qht_remove__locked, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 02/13] qht: add qht_iter_remove, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 03/13] test-qht: test qht_iter_remove, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 04/13] test-qht: test removal of non-existent entries, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 12/13] qht-bench: add -p flag to precompute hash values, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 07/13] qht: drop ht argument from qht iterators, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 13/13] tcg/i386: fix vector operations on 32-bit hosts,
Richard Henderson <=
- [Qemu-devel] [PULL 09/13] qht: constify qht_lookup, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 06/13] test-qht: speed up + test qht_resize, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 08/13] qht: fix comment in qht_bucket_remove_entry, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 11/13] qht: constify arguments to some internal functions, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 10/13] qht: constify qht_statistics_init, Richard Henderson, 2018/09/26
- [Qemu-devel] [PULL 05/13] test-qht: test deletion of the last entry in a bucket, Richard Henderson, 2018/09/26