Added __cpuid function for MSVC6

This commit is contained in:
Ianos Gnatiuc 2006-09-24 16:35:01 +00:00
parent 7ee7d90171
commit 186a608d2c

View File

@ -31,7 +31,9 @@
#if defined(__WIN32__) #if defined(__WIN32__)
#include <windows.h> #include <windows.h>
#if defined(_MSC_VER) && (_MSC_VER > 1200)
#include <intrin.h> #include <intrin.h>
#endif
#elif defined(__GNUC__) #elif defined(__GNUC__)
#include <sys/utsname.h> #include <sys/utsname.h>
#endif #endif
@ -48,6 +50,26 @@
#define _MAX_MNAME_LEN 30 #define _MAX_MNAME_LEN 30
// ------------------------------------------------------------------
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
static void __cpuid(int CPUInfo[4], int cpuidfun)
{
__asm
{
mov eax, cpuidfun
cpuid
mov esi, CPUInfo
mov [esi + 0], eax
mov [esi + 4], ebx
mov [esi + 8], ecx
mov [esi + 12], edx
}
}
#endif
// ------------------------------------------------------------------ // ------------------------------------------------------------------
inline static bool HaveCPUID() inline static bool HaveCPUID()