[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] tcg-target.inc.c: Use byte form of xgetbv instructi
From: |
John Arbuckle |
Subject: |
[Qemu-devel] [PATCH] tcg-target.inc.c: Use byte form of xgetbv instruction |
Date: |
Mon, 4 Jun 2018 17:11:06 -0400 |
The assembler in most versions of Mac OS X is pretty old and does not support
the xgetbv instruction. To go around this problem the raw encoding of the
instruction is used instead.
Signed-off-by: John Arbuckle <address@hidden>
---
tcg/i386/tcg-target.inc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index 5357909..82e004a 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -3501,7 +3501,11 @@ static void tcg_target_init(TCGContext *s)
sure of not hitting invalid opcode. */
if (c & bit_OSXSAVE) {
unsigned xcrl, xcrh;
- asm ("xgetbv" : "=a" (xcrl), "=d" (xcrh) : "c" (0));
+ /*
+ * The xgetbv instruction is not available to older versions of
the
+ * assembler, so we encode the instruction manually.
+ */
+ asm (".byte 0x0f, 0x01, 0xd0": "=a" (xcrl), "=d" (xcrh) : "c" (0));
if ((xcrl & 6) == 6) {
have_avx1 = (c & bit_AVX) != 0;
have_avx2 = (b7 & bit_AVX2) != 0;
--
2.10.2
- [Qemu-devel] [PATCH] tcg-target.inc.c: Use byte form of xgetbv instruction,
John Arbuckle <=