13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

24594 Rev. 3.10 February 2005 AMD64 TechnologyCPUIDProcessor IdentificationProvides information about the processor <strong>and</strong> its capabilities through a number ofdifferent functions. Software should load the number of the CPUID function toexecute into the EAX register before executing the CPUID instruction. The processorreturns information in the EAX, EBX, ECX, <strong>and</strong> EDX registers; the contents <strong>and</strong>format of these registers depend on the function.The architecture supports CPUID information about st<strong>and</strong>ard functions <strong>and</strong> extendedfunctions. The st<strong>and</strong>ard functions have numbers in the 0000_xxxxh series (forexample, st<strong>and</strong>ard function 1). To determine the largest st<strong>and</strong>ard function numberthat a processor supports, execute CPUID function 0.The extended functions have numbers in the 8000_xxxxh series (for example,extended function 8000_0001h). To determine the largest extended function numberthat a processor supports, execute CPUID extended function 8000_0000h. If the valuereturned in EAX is greater than 8000_0000h, the processor supports extendedfunctions.Software operating at any privilege level can execute the CPUID instruction to collectthis information. In 64-bit mode, this instruction works the same as in legacy modeexcept that it zero-extends 32-bit register results to 64 bits.CPUID is a serializing instruction.Mnemonic Opcode DescriptionCPUID0F A2Returns information about the processor <strong>and</strong> its capabilities. EAXspecifies the function number, <strong>and</strong> the data is returned in EAX,EBX, ECX, EDX.Testing for the CPUIDInstructionTo avoid an invalid-opcode exception (#UD) on those processor implementations thatdo not support the CPUID instruction, software must first test to determine if theCPUID instruction is supported. Support for the CPUID instruction is indicated by theability to write the ID bit in the rFLAGS register. Normally, 32-bit software uses thePUSHFD <strong>and</strong> POPFD instructions in an attempt to write rFLAGS.ID. After readingthe updated rFLAGS.ID bit, a comparison determines if the operation changed itsvalue. If the value changed, the processor executing the code supports the CPUIDCPUID 117

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!