c - Why should I use 'rdtsc' differently on x86 and x86_x64? -


i know rdtsc loads current value of processor's time-stamp counter 2 registers: edx , eax. in order on x86 need (assuming using linux):

    unsigned long lo, hi;     asm( "rdtsc" : "=a" (lo), "=d" (hi));     return lo; 

and x86_x64:

        unsigned long lo, hi;         asm( "rdtsc" : "=a" (lo), "=d" (hi) );          return( lo | (hi << 32) ); 

why that? can explain me?

in x86-64 mode, rdtsc clears higher 32 bits of rax. compensate bits have shift hi left 32 bits.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -