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 2005RDTSCRead Time-Stamp CounterLoads the value of the processor’s 64-bit time-stamp counter into registers EDX:EAX.The time-stamp counter is contained in a 64-bit model-specific register (MSR). Theprocessor sets the counter to 0 upon reset <strong>and</strong> increments the counter every clockcycle. INIT does not modify the TSC.The high-order 32 bits are loaded into EDX, <strong>and</strong> the low-order 32 bits are loaded intothe EAX register. This instruction ignores oper<strong>and</strong> size.When the time-stamp disable flag (TSD) in CR4 is set to 1, the RDTSC instruction canonly be used at privilege level 0. If the TSD flag is 0, this instruction can be used at anyprivilege level.This instruction is not serializing. Therefore, there is no guarantee that all instructionshave completed at the time the time-stamp counter is read.Mnemonic Opcode DescriptionRDTSC 0F 31 Copy the time-stamp counter into EDX:EAX.Related <strong>Instructions</strong>RDTSCP, RDMSR, WRMSRrFLAGS AffectedNoneExceptionsException RealVirtual8086 Protected Cause of ExceptionInvalid opcode, #UD X X X The RDTSC instruction is not supported, as indicated by EDX bit 4returned by CPUID st<strong>and</strong>ard function 1 or extended function8000_0001h.<strong>General</strong> protection, #GP X X CPL was not 0 <strong>and</strong> CR4.TSD = 1.336 RDTSC

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

Saved successfully!

Ooh no, something went wrong!