On Windows, there is a bunch of bugs.
- On W2003 SP1, Vista, XP-64 GetLogicalProcessorInformation() is the
recommended api. It returns # of cores on AMD and # of logical procs on
Intel.
- GetSystemInfo() is on XP-32 and Windows Server. It does not work in
wow mode. I think GetNativeSystemInfo is needed.
- For x64, the VC/VC++ the __cpuid() intrinsic returns
wrong information
The root cause is that the incorrect versions use the cpuid
instruction incorrectly. __cpuid() uses old style cpuid and takes input from
eax only instead of eax, ecx . GetSystemInfo() uses the registers in short
mode when doing cpuid, so I think it fails for wow. It is amazing how
Windows works at all!
On 11/1/06, Xiao-Feng Li <[EMAIL PROTECTED]> wrote:
On 11/1/06, Alexey Varlamov <[EMAIL PROTECTED]> wrote:
> Just a wild guess: this may be caused by x86 emulation on em64t
> (x86_64). SDK docs advise to use GetNativeSystemInfo() in such case,
> instead of currently used GetSystemInfo(). (See
> vm\port\src\misc\win\sysinfo.c).
>
huh, I guess you are right, since my machine is X86-64bit. :-) I will
try the API you pointed.
Thanks,
xiaofeng