All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] tcg-target.inc.c: Use byte form of xgetbv instruction
@ 2018-06-04 21:51 John Arbuckle
  2018-06-05 15:39 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: John Arbuckle @ 2018-06-04 21:51 UTC (permalink / raw)
  To: peter.maydell, qemu-devel; +Cc: John Arbuckle

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
---
v2 changes:
- Fixed a spacing issue in the asm() function.

 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 5357909fff..09141fa8e0 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.14.3 (Apple Git-98)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-05 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-04 21:51 [Qemu-devel] [PATCH v2] tcg-target.inc.c: Use byte form of xgetbv instruction John Arbuckle
2018-06-05 15:39 ` Richard Henderson

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.