This is a very old article written by me (around 2001, I guess) and it is just here for record.
Hi again. This is my fourth tutorial and here, I will explain how to find out the CPU Name and its features. It can be used to find out if the processor supports certain instruction sets or does it incorporate some devices. Let us start.
To work with this technology, you have to know Assembly. You need to know about instructions and also binary notation for numbers. You should also know about bits and working with them in Assembly to use this technique.
To find out the CPU Name and other features, you have to use the command(or instruction) CPUID. This instruction reads the value in the register EAX and returns appropriate information in register. Here, I will document what can be found out using this instruction and how.
But first, a very important thing you need to know about this instruction. This instruction is only supported on Pentium and later. However, newer 486 chips by AMD, Cyrix etc.. support this instruction. So, this will work only on such Systems. If you want to know the opcode of the instruction CPUID, it is 0F A2. If you don’t know what this means, forget it. It won’t be of much help to you then.
Well, let’s get to the point. The basic of this instruction is that you have to specify it what is has to do. You can do this by passing an appropriate value in the EAX register. All those values which you can pass and their results are documented below.
CPU Vendor information
Input:
EAX = 0
Returns:
EAX = Maximum number of function
EBX:EDX:ECX = CPU Vendor string
Explanation:
This is the most basic of all the functions of CPUID. In EAX, it returns a number which tells the function number of the last function that CPUID can use. In EBX:EDX:ECX, it returns a 12-byte string which tells the CPU Vendor name. This functions returns GenuineIntel on a Pentium system, AuthenticAMD on a AMD computer and CyrixInstead on a Cyrix chip in EBX:EDX:ECX. For eg. AMD processor will output Auth in EBX, enti in EDX and cAMD in ECX. Similiarly, Intel will give Genu in EBX, ineI in EDX and ntel in ECX.
CPU Features
Input:
EAX = 1
Returns:
EAX = CPUID signature
EBX = Extra info
EDX = CPU Features flag
Explanation:
This is also a commonly used function. In EAX, it gives a value of which bits 31..16 are undefined, bits 15..12 tell the type of the CPU, bits 11..8 tell about the family, bits 7..4 tell the model of the CPU and the bits 3..0 tell the mask revision
In EBX, bits 31..24 gives the default APIC ID, bits 23..16 gives Logical Processor ID, bits 15..8 gives the Cache Flush Chunk size and bits 7..0 give away the Brand ID(Only Pentium III and upwards).
In EDX, the CPU feature flags are returned in which each bit has a meaning. Refer this table.
Bit Explanation
00 Tells whether FPU is present
01 Virual 86 mode extensions
02 Debug extensions - I/O Breakpoints
03 Page Size extensions(4MB Pages)
04 Time Stamp Counter
05 Model Specific Registers
06 Physical address extensions(36 bit address)
07 Machine check Exception
08 CMPXCHG8B available
09 APIC present
09 AMD K5: Global Pages supported
10 Reserved(Fast system call on AMD)
11 Intel: Fast system call
12 Memory type range registers
13 Global pages supported
14 Machine Check Architecture
15 Conditional MOV instructions
16 Page attribute table
17 36 bit Page size extensions
18 Processor serial number
19 Cache Flush
21 Debug Trace Store
22 ACPI Support
23 MMX Extensions
24 FXSAVE and FXRSTOR
25 SSE Instructions
26 SSE 2 Instructions
27 Self-Snoop
29 Automatic Clock control
30 IA-64 Instructions
31 3DNow! Instructions
Note that some manufacturers define each of the bits a little differently.
CPU Cache & TLB
Input:
EAX = 2
Explanation:
This is given in Pentium Pro manuals.
CPU Serial no.
Input:
EAX = 3
Returns:
EAX = CPU serial number
Explanation:
This function returns Processor serial no in EAX. See EAX, bit 18 above.
Extended CPUID Info
Input:
EAX = 80000000h
Returns:
EAX = maximum extended CPUID function
Explanation:
Returns the maximum number of function that can be called for extended CPUID. Usually, 8000000xh.
CPU Name
Input:
EAX = 80000002h..80000004h
Returns:
EAX:EBX:ECX:EDX = CPU name
Explanation:
Returns the CPU Name, a 48 byte string(if less, padded with zeros). This function is carried over 3 calls. The first call with EAX = 80000002h, returns 16 byte string in EAX:EBX:ECX:EDX. Similiarly, with EAX = 80000003h and EAX = 80000004h, the remaining 16 + 16 bytes are retrieved. Combining all these, you get the name of the CPU in 48 byte string.
Extra Info
Input:
EAX = 80000005h
Returns:
L1 Cache Information
Input:
EAX = 80000006h
Returns:
L2 Cache Information
Input:
EAX = 80000007h
Returns:
Power management features
Input:
EAX = 80000008h
Returns:
More info regarding AMD Hammer family