Get information on CPU

zhaozj2021-02-12  152

/ * * Get CPU information with assembly EAX = 0 calls CPUID EBX, EDX, ECX Return to CPU OEM information EAX = 0 calls CPUID EAX 8--11 indicates a few 86 3 -------- 386 4 -------- 486 5 -------- Pentium 6 -------- Pentium Pro Pentium II 2 -------- Dual Processors

Detection is a P6 purchase frame EAX = 1 cpuid if Al = 1, is Pentium Pro Pentium II

AMD CPU EAX = 80000001 CPUID

--------------------- EAX = 51H AMD K5 EAX = 66h k6 * / # include #include #pragma hdrstop // # Pragma inline / // # prgma argsused

Using namespace std;

Int main () {char Oemstr [13]; int EaxValue, EbxValue, EcxValue, EdxValue; _ASM {MOV EAX, 0 CPUID MOV DWORD PTR OEMSTR 4, EBX MOV DWORD PTR OEMSTR 8, ECX MOV BYTE PTR Oemstr 12,0} cout << "this cpu's oem string is:" << Oemstr << Endl; _ASM {MOV EAX, 1 CPUID

Mov EaxValue, EBX MOV EBXVALUE, EBX MOV ECXVALUE, EBX MOV ECXVALUE, ECX MOV EDXVALUE, ECX MOV Edxvalue, ECX} IF (EdxValue & 0x800000) {COUT << "This is MMX CPU" << ENDL;} else {cout << "not mmx support" << Endl;

INT CPUFAMILY = (0xF00 & EaxValue) >> 8; COUT << "CPU Family IS: << CPUFAMILY << Endl; Int Alvalue; _ASM {Mov Eax, 2 cpuid MOV BYTE PTR Alvalue, Al} if (AlValue == 1) {COUT << "Pentium Pro or Pentium II Found" << Endl;} getCH (); Return 0;}

转载请注明原文地址:https://www.9cbs.com/read-7048.html

New Post(0)