This is an old revision of the document!
cpuid [--amd] [--ecx] <bit number>
cpuid --amd 29 && set arch x86_64 || set arch i386
cpuid 6 && set pae yes ||
cpuid --ecx 5 && set vmx yes || cpuid --amd --ecx 2 && set svm yes || isset ${vmx} || isset ${svm} && set hw_virt yes ||
Check for the existence of the specified x86 CPU feature using the CPUID
instruction. If the --amd
option is specified then the AMD-defined ("extended") feature set is checked, otherwise the Intel-defined ("standard") feature set is checked. If the --ecx
option is specified then the feature set contained in the %ecx
register is checked, otherwise the feature set contained in the %edx
register is checked.
Some useful features to check are:
Feature set | Register | Bit | Feature | Command |
---|---|---|---|---|
AMD | %edx | 29 | Long mode (64-bit) | cpuid --amd 29 |
Intel | %edx | 6 | Physical address extensions (PAE) | cpuid 6 |
Intel | %ecx | 5 | Virtual Machine Extensions (VMX) | cpuid --ecx 5 |
AMD | %ecx | 2 | Secure Virtual Machine (SVM) | cpuid --amd --ecx 2 |
Intel | %edx | 15 | Conditional Move (CMOV) | cpuid 15 |
Success | The specified x86 CPU feature is present |
---|---|
Failure | The specified x86 CPU feature is not present |
The Intel-defined ("standard") feature set represents the values returned in %ecx
and %edx
when CPUID
is called with %eax=0x00000001
.
The AMD-defined ("extended") feature set represents the values returned in %ecx
and %edx
when CPUID
is called with %eax=0x80000001
.