CPUID: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
m rm whitespace at top
No edit summary
Line 16:
When called with EAX = 0, CPUID returns the brand name in EBX, EDX and ECX. Writing these to memory in this order results in a 12-character string. These can be tested against known brands:
 
{{code|CPUID Vendor Strings|
<pre>
/* Vendor-strings. */
Line 31 ⟶ 30:
#define CPUID_VENDOR_RISE "RiseRiseRise"
</pre>
}}
 
Also, EAX is set to the maximum EAX value supported for CPUID calls, as not all queries are supported on all processors
Line 41 ⟶ 39:
Recent processors also use ECX for features (which form a different set), with which you should be very careful as some old CPUs return bogus information in this register.
 
{{code|CPUID flags|
<pre>
/* Flags. */
Line 75 ⟶ 72:
#define CPUID_FLAG_PBE 0x80000000 /* Pending Break Event. */
</pre>
}}
 
== Using CPUID from GCC ==
Line 81 ⟶ 77:
CPUID can be invoked with various request codes (in eax) and will return values in general registers (much as a built-in service interrupt). The following code is made Public Domain out of Clicker's x86/cpu.h
 
{{code|CPUID in GCC|
<pre>
enum cpuid_requests {
Line 113 ⟶ 108:
}
</pre>
}}
== See Also ==