X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fx86_cpu_features.c;h=3995413d6495b518181fcc2a843211f9a90b3fc7;hb=e4cdc80a6d033bb27ac0d1687ca32d0434673128;hp=aab200ffe5f2bb9b682592f8c4dee461234c2dbd;hpb=719a063c87e3abab99b0fb53ebc80223fbf33123;p=wimlib diff --git a/src/x86_cpu_features.c b/src/x86_cpu_features.c index aab200ff..3995413d 100644 --- a/src/x86_cpu_features.c +++ b/src/x86_cpu_features.c @@ -1,15 +1,27 @@ /* - * x86_cpu_features.c + * x86_cpu_features.c - feature detection for x86 processors * - * Feature detection for x86 processors. + * The following copying information applies to this specific source code file: * - * Author: Eric Biggers - * Year: 2015 + * Written in 2015 by Eric Biggers * - * The author dedicates this file to the public domain. - * You can do whatever you want with this file. + * To the extent possible under law, the author(s) have dedicated all copyright + * and related and neighboring rights to this software to the public domain + * worldwide via the Creative Commons Zero 1.0 Universal Public Domain + * Dedication (the "CC0"). + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the CC0 for more details. + * + * You should have received a copy of the CC0 along with this software; if not + * see . */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "wimlib/x86_cpu_features.h" #if defined(__i386__) || defined(__x86_64__) @@ -47,7 +59,9 @@ read_xcr(u32 index) { u32 edx, eax; - __asm__ ("xgetbv" : "=d" (edx), "=a" (eax) : "c" (index)); + /* Execute the "xgetbv" instruction. Old versions of binutils do not + * recognize this instruction, so list the raw bytes instead. */ + __asm__ (".byte 0x0f, 0x01, 0xd0" : "=d" (edx), "=a" (eax) : "c" (index)); return ((u64)edx << 32) | eax; }