CPUID: Difference between revisions
→Checking CPUID availability: increase comment quality
[unchecked revision] | [unchecked revision] |
(→Checking CPUID availability: increase comment quality) |
|||
Line 10:
<source lang="asm">
pushfd
pushfd ;Store EFLAGS▼
pushfd
xor dword [esp], 0x00200000
popfd
pushfd
pop eax
xor eax, [esp]
ret▼
and eax, 0x00200000 ; eax = zero if ID bit can't be changed, else non-zero
</source>
Line 25 ⟶ 28:
Note 2: You can simply attempt to execute the CPUID instruction and see if you get an invalid opcode exception. This avoids problems with CPUs that do support CPUID but don't support the ID bit in EFLAGS; and is likely to be faster for CPUs that do support CPUID (and slower for CPUs that don't).
=== Basic usage ===
|