Volume 3: General-Purpose and System Instructions - Stanford ...
Volume 3: General-Purpose and System Instructions - Stanford ... Volume 3: General-Purpose and System Instructions - Stanford ...
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 and increments the counter every clockcycle. INIT does not modify the TSC.The high-order 32 bits are loaded into EDX, and the low-order 32 bits are loaded intothe EAX register. This instruction ignores operand 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 InstructionsRDTSCP, 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 standard function 1 or extended function8000_0001h.General protection, #GP X X CPL was not 0 and CR4.TSD = 1.336 RDTSC
24594 Rev. 3.10 February 2005 AMD64 TechnologyRDTSCPRead Time-Stamp Counter and Processor IDLoads the value of the processor’s 64-bit time-stamp counter into registers EDX:EAX,and loads the value of TSC_AUX into ECX. This instruction ignores operand size.The time-stamp counter is contained in a 64-bit model-specific register (MSR). Theprocessor sets the counter to 0 upon reset and increments the counter every clockcycle. INIT does not modify the TSC.The high-order 32 bits are loaded into EDX, and the low-order 32 bits are loaded intothe EAX register.The TSC_AUX value is contained in the low-order 32 bits of the TSC_AUX register(MSR address C000_0103h). This MSR is initialized by privileged software to anymeaningful value, such as a processor ID, that software wants to associate with thereturned TSC value.When the time-stamp disable flag (TSD) in CR4 is set to 1, the RDTSCP instructioncan only be used at privilege level 0. If the TSD flag is 0, this instruction can be used atany privilege level.Unlike the RDTSC instruction, RDTSCP is a serializing instruction.Use the CPUID instruction to verify support for this instruction.Mnemonic Opcode DescriptionRDTSC P 0F 01 F9 Copy the time-stamp counter into EDX:EAX. and theTSC_AUX register into ECX.Related InstructionsRDTSCrFLAGS AffectedNoneRDTSCP 337
- Page 316 and 317: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 318 and 319: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 320 and 321: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 322 and 323: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 324 and 325: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 326 and 327: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 328 and 329: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 330 and 331: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 332 and 333: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 334 and 335: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 336 and 337: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 338 and 339: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 340 and 341: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 342 and 343: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 344 and 345: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 346 and 347: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 348 and 349: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 350 and 351: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 352 and 353: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 354 and 355: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 356 and 357: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 358 and 359: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 360 and 361: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 362 and 363: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 364 and 365: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 368 and 369: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 370 and 371: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 372 and 373: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 374 and 375: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 376 and 377: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 378 and 379: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 380 and 381: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 382 and 383: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 384 and 385: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 386 and 387: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 388 and 389: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 390 and 391: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 392 and 393: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 394 and 395: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 396 and 397: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 398 and 399: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 400 and 401: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 402 and 403: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 404 and 405: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 406 and 407: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 408 and 409: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 410 and 411: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 412 and 413: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 414 and 415: AMD64 Technology 24594 Rev. 3.10 Fe
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