CPUID: Difference between revisions

m
Added a note
[unchecked revision][unchecked revision]
m (→‎External Links: the link to AMD's documentation was dead)
m (Added a note)
Line 2:
 
== How to use CPUID ==
=== Checking CPUID availability ===
Note that priorPrior to useusing the CPUID instruction, you should also make sure the processor supports it by testing the 'ID' bit (0x200000) in eflags. This bit is (modifiable only when the CPUID instruction is supported. For systems that don't support CPUID, writingchanging athe '1ID' at that placebit will have no effect).
 
'''Note:''' Implementing this routine in for example C can lead to issues, because the compiler may change EFLAGS at any time.
Note that prior to use the CPUID instruction, you should also make sure the processor supports it by testing the 'ID' bit (0x200000) in eflags (modifiable only when the CPUID instruction is supported. For systems that don't support CPUID, writing a '1' at that place will have no effect).
 
Here is anThis assembly routine that checks if CPUID is supported:
 
<source lang="asm">
Line 24 ⟶ 27:
</source>
 
=== Basic usage ===
The idea of the CPUID instruction is that you can call it with different values in EAX, and it will return different information about the processor. For example, if we want the Vendor ID String (see below), we should code something like that:
 
89

edits