changeset 30714:313cc6c3fddb

Replace =A with =a and =d; make frequency calculation correct under x86-64
author zuxy
date Sat, 27 Feb 2010 12:10:34 +0000
parents 9dc765bfa063
children f5ecd7dd58e8
files cpuinfo.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/cpuinfo.c	Sat Feb 27 11:32:48 2010 +0000
+++ b/cpuinfo.c	Sat Feb 27 12:10:34 2010 +0000
@@ -77,10 +77,10 @@
 static int64_t
 rdtsc(void)
 {
-  uint64_t i;
+  uint64_t hi, lo;
 #define RDTSC   ".byte 0x0f, 0x31; "
-  __asm__ volatile (RDTSC : "=A"(i) : );
-  return i;
+  __asm__ volatile (RDTSC : "=a"(lo), "=d"(hi) : );
+  return hi << 32 | lo;
 }
 
 static const char*