This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/tvtime.git tree:

Subject: cpuinfo: Fix rdtsc on x86_64
Author:  Hans de Goede <[email protected]>
Date:    Wed Mar 9 17:49:38 2016 +0100

Using =A as dest reg on x86_64 results in only reading the lower
32 bits of the rdtsc, which results in a wrong CPU-freq being reported
when the lower 32 bits of rdtsc overflow between our 2 reads.

Also see:
https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints

Signed-off-by: Hans de Goede <[email protected]>

 src/cpuinfo.c | 9 +++++++++
 1 file changed, 9 insertions(+)

---

http://git.linuxtv.org/cgit.cgi/tvtime.git/commit/?id=31b5a7094c515dd6f06bb6988ee19ed0d1c7b279
diff --git a/src/cpuinfo.c b/src/cpuinfo.c
index 0f6c5973434c..8591bf2730ad 100644
--- a/src/cpuinfo.c
+++ b/src/cpuinfo.c
@@ -45,7 +45,16 @@
 
 #ifdef ARCH_X86
 
+#ifndef __x86_64__
 #define rdtscll(val) __asm__ __volatile__("rdtsc" : "=A" (val))
+#else
+#define rdtscll(val) \
+    do { \
+        uint32_t tickl, tickh; \
+        __asm__ __volatile__("rdtsc" : "=a" (tickl), "=d" (tickh)); \
+        val = ((uint64_t)tickh << 32) | tickl; \
+    } while (0)
+#endif
 
 double cpuinfo_get_speed( void )
 {

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to