Skip to contentSkip to conversation

use common code for i386 and x86_64

PATCH In review Glauber Costa 2 participants 2 messages Apr 30, 2008 – May 3, 2008 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use common code for i386 and x86_64

There is no reason why should i386 and x86_64 code for rdtsc be different. Unify them.

---
 cpu-all.h |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)
cpu-all.h +1 -10
index 2a2b197..1c9e2a3 100644
@@ -930,16 +930,7 @@ static inline int64_t cpu_get_real_ticks(void)
     return ((int64_t)h << 32) | l;
 }
 
-#elif defined(__i386__)
-
-static inline int64_t cpu_get_real_ticks(void)
-{
-    int64_t val;
-    asm volatile ("rdtsc" : "=A" (val));
-    return val;
-}
-
-#elif defined(__x86_64__)
+#elif defined(__i386__) || defined(__x86_64__)
 
 static inline int64_t cpu_get_real_ticks(void)
 {
Signature · 8 lines
1.5.0.6


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
#1 lore raw
Quoted 2 lines · Glauber Costa

There is no reason why should i386 and x86_64 code for rdtsc be different. Unify them.

This makes the generated i386 assembly code far more complex (21 instructions instead of 5).

Quoted 32 lines
---
 cpu-all.h |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)
cpu-all.h +1 -10
index 2a2b197..1c9e2a3 100644
@@ -930,16 +930,7 @@ static inline int64_t cpu_get_real_ticks(void)
     return ((int64_t)h << 32) | l;
 }
 
-#elif defined(__i386__)
-
-static inline int64_t cpu_get_real_ticks(void)
-{
-    int64_t val;
-    asm volatile ("rdtsc" : "=A" (val));
-    return val;
-}
-
-#elif defined(__x86_64__)
+#elif defined(__i386__) || defined(__x86_64__)
 
 static inline int64_t cpu_get_real_ticks(void)
 {
Signature · 1 line
1.5.0.6
Signature · 10 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone