How to get the model, frequency, support set of the CPU, etc., CPUID introduction

xiaoxiao2021-03-06  48

As a software developer, we are a variety of customers, and the computers they use are also the same. However, the extension command set provided by the different frequency of the CPU is also different. Therefore, sometimes I need to understand the customer's CPU if I need to support MMX when developing software. Is there 3DNOW, a high frequency is high, how type CPU, sequence What is it? In order to solve the above needs Intel company, the CPUID instruction is provided after 80486. By calling this instruction, it can basically take the vast majority of the parameters for the CPU. The CPUID sets the value in EAX, and the value is returned in EAX, EBX, ECX, and EDX. A bit like interrupt function call. Set different values ​​in EAX, returning the appropriate information in EAX, EBX, ECX, and EDX. For example, set 3 in EAX, returns 64-bit CPU serial numbers in ECX and EDX, of course, the CPU after PIII has a unique serial number. Test, we can use VC6.0, create a new blank Win32 console application to add a CPP file as follows #include #include

Void main () {char Serialno [9];

_ASM {MOV EAX, 0x3 CPUID MOV DWORD PTR [Serialno], EDX MOV DWORD PTR [Serialno 4], ECX} Serialno [9] = 0;

Printf ("Serialno String:% S / N", Serialno);

By setting different "function call numbers" in EAX, CPU type, caching, and so on. You can refer to the Related reference manual for CUPID. This is coupling to everyone.

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

New Post(0)