32 #define cpuid(index, eax, ebx, ecx, edx)        \ 
   33     ff_cpu_cpuid(index, &eax, &ebx, &ecx, &edx) 
   35 #define xgetbv(index, eax, edx)                 \ 
   36     ff_cpu_xgetbv(index, &eax, &edx) 
   41 #define cpuid(index, eax, ebx, ecx, edx)                        \ 
   43         "mov    %%"REG_b", %%"REG_S" \n\t"                      \ 
   45         "xchg   %%"REG_b", %%"REG_S                             \ 
   46         : "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx)        \ 
   49 #define xgetbv(index, eax, edx)                                 \ 
   50     __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index)) 
   52 #define get_eflags(x)                           \ 
   53     __asm__ volatile ("pushfl     \n"           \ 
   57 #define set_eflags(x)                           \ 
   58     __asm__ volatile ("push    %0 \n"           \ 
   66 #define cpuid_test() 1 
   70 #define cpuid_test ff_cpu_cpuid_test 
   74 static int cpuid_test(
void)
 
   81     set_eflags(a ^ 0x200000);
 
   95     int eax, ebx, ecx, edx;
 
   96     int max_std_level, max_ext_level, std_caps = 0, ext_caps = 0;
 
   97     int family = 0, model = 0;
 
   98     union { 
int i[3]; 
char c[12]; } vendor;
 
  103     cpuid(0, max_std_level, vendor.i[0], vendor.i[2], vendor.i[1]);
 
  105     if (max_std_level >= 1) {
 
  106         cpuid(1, eax, ebx, ecx, std_caps);
 
  107         family = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
 
  108         model  = ((eax >> 4) & 0xf) + ((eax >> 12) & 0xf0);
 
  109         if (std_caps & (1 << 15))
 
  111         if (std_caps & (1 << 23))
 
  113         if (std_caps & (1 << 25))
 
  116         if (std_caps & (1 << 25))
 
  118         if (std_caps & (1 << 26))
 
  122         if (ecx & 0x00000200 )
 
  124         if (ecx & 0x00080000 )
 
  126         if (ecx & 0x00100000 )
 
  130         if ((ecx & 0x18000000) == 0x18000000) {
 
  133             if ((eax & 0x6) == 0x6)
 
  140     cpuid(0x80000000, max_ext_level, ebx, ecx, edx);
 
  142     if (max_ext_level >= 0x80000001) {
 
  143         cpuid(0x80000001, eax, ebx, ecx, ext_caps);
 
  144         if (ext_caps & (1
U << 31))
 
  146         if (ext_caps & (1 << 30))
 
  148         if (ext_caps & (1 << 23))
 
  150         if (ext_caps & (1 << 22))
 
  160         if (!strncmp(vendor.c, 
"AuthenticAMD", 12) &&
 
  168             if (ecx & 0x00000800)
 
  170             if (ecx & 0x00010000)
 
  175     if (!strncmp(vendor.c, 
"GenuineIntel", 12)) {
 
  176         if (family == 6 && (model == 9 || model == 13 || model == 14)) {
 
  194         if (family == 6 && model == 28)