diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-03-14 17:11:14 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-03-24 16:26:07 -0400 |
commit | cf0d0d63645bcb6425a1e2d7b5d9f1e26e205247 (patch) | |
tree | f12a5b8f16782615370c41da0ca067d6a294503a | |
parent | 8a8aabf05c8e6c7b68b68c80e4e73877fd35ce78 (diff) |
Use "=a" and "=d" constraints for rdtsc inline assembly
In 32 bit mode the "=A" constraint refers to the register pair
edx:eax, but according to GCC developers this is not the case in 64
bit mode, where it refers to "rax".
Hence, using "=A" for rdtsc is incorrect in 64 bit mode.
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21249
-rw-r--r-- | pixman/pixman-private.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 9d96a93..0cba2e9 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -936,10 +936,11 @@ _pixman_log_error (const char *function, const char *message); static inline uint64_t oil_profile_stamp_rdtsc (void) { - uint64_t ts; + uint32_t hi, lo; - __asm__ __volatile__ ("rdtsc\n" : "=A" (ts)); - return ts; + __asm__ __volatile__ ("rdtsc\n" : "=a" (lo), "=d" (hi)); + + return lo | (((uint64_t)hi) << 32); } #define OIL_STAMP oil_profile_stamp_rdtsc |