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? 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" );
Thanks. |