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.

AMD64 Technology 24594 Rev. 3.10 February 2005instruction. If the value did not change, rFLAGS.ID is not writable, <strong>and</strong> the processordoes not support the CPUID instruction.The following code sample shows how to test for the presence of the CPUIDinstruction using 32-bit code.pushfd; save EFLAGSpop eax ; store EFLAGS in EAXmov ebx, eax ; save in EBX for later testingxor eax, 00200000h ; toggle bit 21push eax ; push to stackpopfd; save changed EAX to EFLAGSpushfd; push EFLAGS to TOSpop eax ; store EFLAGS in EAXcmp eax, ebx ; see if bit 21 has changedjz NO_CPUID ; if no change, no CPUIDSt<strong>and</strong>ard Function 0:Processor Vendor <strong>and</strong>Largest St<strong>and</strong>ardFunction NumberAll software using the CPUID instruction must execute st<strong>and</strong>ard function 0. Thisfunction returns the largest st<strong>and</strong>ard function number <strong>and</strong> the processor vendor.St<strong>and</strong>ard Function 0 EAX: Largest St<strong>and</strong>ard Function Number. St<strong>and</strong>ard function 0 loads EAXwith the largest CPUID st<strong>and</strong>ard function number supported by the processorimplementation.St<strong>and</strong>ard Function 0 EBX, EDX, <strong>and</strong> ECX: Processor Vendor. St<strong>and</strong>ard function 0 loads a12-character string into the EBX, EDX, <strong>and</strong> ECX registers identifying the processorvendor. For AMD processors, the string is AuthenticAMD. This string informs softwarethat it should follow the AMD CPUID definition for subsequent CPUID function calls.If the function returns a another vendor’s string, software must use that vendor’sCPUID definition when interpreting the results of subsequent CPUID function calls.Table 3-1 shows the contents of the EBX, EDX, <strong>and</strong> ECX registers after executingfunction 0 on an AMD processor.Table 3-1.Processor Vendor Return ValuesRegister Return Value ASCII CharactersEBX 6874_7541h “h t u A”EDX 6974_6E65h “i t n e”ECX 444D_4163h “D M A c”118 CPUID

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

Saved successfully!

Ooh no, something went wrong!