From: John Arbuckle <programmingkidx@gmail.com>
To: peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: John Arbuckle <programmingkidx@gmail.com>
Subject: [Qemu-devel] [PATCH] tcg-target.inc.c: Use byte form of xgetbv instruction
Date: Mon, 4 Jun 2018 17:11:06 -0400 [thread overview]
Message-ID: <20180604211106.4442-1-programmingkidx@gmail.com> (raw)
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 <programmingkidx@gmail.com>
---
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
next reply other threads:[~2018-06-04 21:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 21:11 John Arbuckle [this message]
2018-06-04 21:15 ` [Qemu-devel] [PATCH] tcg-target.inc.c: Use byte form of xgetbv instruction no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180604211106.4442-1-programmingkidx@gmail.com \
--to=programmingkidx@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.