Commit 1019242a authored by John Arbuckle's avatar John Arbuckle Committed by Richard Henderson
Browse files

tcg/i386: Use byte form of xgetbv instruction



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: default avatarJohn Arbuckle <programmingkidx@gmail.com>
Message-Id: <20180604215102.11002-1-programmingkidx@gmail.com>
Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
parent 42747d6a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3501,7 +3501,10 @@ 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;