No title

Anonymous Coward 2018-03-05 01:27:02.805505 UTC

1uint64_t msr;
2
3asm volatile ( "rdtsc\n\t" // Returns the time in EDX:EAX.
4 "shl $32, %%rdx\n\t" // Shift the upper bits left.
5 "or %%rdx, %0" // 'Or' in the lower bits.
6 : "=a" (msr)
7 :
8 : "rdx");
9
10printf("msr: %llx\n", msr);
11
12// Do other work...
13
14// Reprint the timestamp
15asm volatile ( "rdtsc\n\t" // Returns the time in EDX:EAX.
16 "shl $32, %%rdx\n\t" // Shift the upper bits left.
17 "or %%rdx, %0" // 'Or' in the lower bits.
18 : "=a" (msr)
19 :
20 : "rdx");
21
22printf("msr: %llx\n", msr);