Skip to main content
GameDev.net gamedev.net
🔒 Locked

Detecting hyperthreading and 64 bit cpu

Started by flat2 Sep 2, 2004 at 5:30 AM 3 replies 2.6k views
Original Post
flat2
flat2
Hi. Does anyone know how to do a check to discover if a users cpu supports hyperthreading, or if a users cpu is 64 bit? I'm using dxdiag for the other information I need, but this specific information is not available. Any ideas/pointers that don't involve cross-referencing the cpu name with a list greatly appreciated!
flat2
flat2
Part one solved: A piece of code for checking hyperthreading can be found here .
Austrian Coder
Austrian Coder
I dont know if intel has 64 bit cpus, but i know how to detect a AMD 64Bit cpu - untested, but should work.

cpuid(0x80000000,eax,ebx,unused,edx);				// now in eax there is the max. supported extended CPUID level				// we check if theres an extended CPUID level support				if (eax >= 0x80000001)				{					// If we can access the extended CPUID level 0x80000001 we get the					// edx register					if (cpuid(0x80000001,eax,ebx,unused,edx))					{						// Now we can mask some specific cpu extensions												m_Info._AMD64Bit = ((edx & 1<<29) != 0);					}				}
Mastaba
Mastaba
The cpuid assembly instruction can be used to get all of that information. The AMD cpuid documentation describes how to detect long mode which is the 64 bit mode that Athlon 64 and Opteron use.

Also, Intel Pentium cpus use the same bit in the extended flags for the same purpose.
flat2
flat2
Cheers guys, I'll check that out.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.