src/cpuinfo/SDL_cpuinfo.c
changeset 8241 b6d5a589ce3f
parent 8240 334257cd613d
child 8642 3506de54b829
     1.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Sat Feb 22 18:01:18 2014 -0800
     1.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Sat Feb 22 19:10:45 2014 -0800
     1.3 @@ -98,7 +98,7 @@
     1.4      );
     1.5  #elif defined(__GNUC__) && defined(__x86_64__)
     1.6  /* Technically, if this is being compiled under __x86_64__ then it has 
     1.7 -CPUid by definition.  But it's nice to be able to prove it.  :)      */
     1.8 +   CPUid by definition.  But it's nice to be able to prove it.  :)      */
     1.9      __asm__ (
    1.10  "        pushfq                      # Get original EFLAGS             \n"
    1.11  "        popq    %%rax                                                 \n"
    1.12 @@ -131,6 +131,8 @@
    1.13          mov     has_CPUID,1         ; We have CPUID support
    1.14  done:
    1.15      }
    1.16 +#elif defined(_MSC_VER) && defined(_M_X64)
    1.17 +    has_CPUID = 1;
    1.18  #elif defined(__sun) && defined(__i386)
    1.19      __asm (
    1.20  "       pushfl                 \n"
    1.21 @@ -191,7 +193,17 @@
    1.22          __asm mov b, ebx \
    1.23          __asm mov c, ecx \
    1.24          __asm mov d, edx \
    1.25 -    }
    1.26 +}
    1.27 +#elif defined(_MSC_VER) && defined(_M_X64)
    1.28 +#define cpuid(func, a, b, c, d) \
    1.29 +{ \
    1.30 +    int CPUInfo[4]; \
    1.31 +    __cpuid(CPUInfo, func); \
    1.32 +    a = CPUInfo[0]; \
    1.33 +    b = CPUInfo[1]; \
    1.34 +    c = CPUInfo[2]; \
    1.35 +    d = CPUInfo[3]; \
    1.36 +}
    1.37  #else
    1.38  #define cpuid(func, a, b, c, d) \
    1.39      a = b = c = d = 0