Results 1 to 1 of 1
Hello. I'm trying to read the Cycle Counter register in an Intel Pentium processor. I'm trying to use gcc and AT&T inline assembly.
The Pentium assembly instruction RDTSC gets the ...
- 12-19-2006 #1Just Joined!
- Join Date
- Dec 2006
- Location
- Milwaukee, WI
- Posts
- 16
AT&T Inline Assembly
Hello. I'm trying to read the Cycle Counter register in an Intel Pentium processor. I'm trying to use gcc and AT&T inline assembly.
The Pentium assembly instruction RDTSC gets the 64-bit value in the cycle counter register and puts it in EAX (low 32-bits) and EDX (high 32-bits).
Can someone please verify for me that the following code will save this value properly?
Thanks.Code:unsigned long low_ticks; // stores low-order cycle count unsigned long high_ticks; // stores high-order cycle count __asm( " push %eax" ); __asm( " push %edx" ); __asm( " rdtsc" : "=A" (low_ticks), "=D" (high_ticks) ); __asm( " pop %edx" ); __asm( " pop %eax" );


Reply With Quote
