qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] use common code for i386 and x86_64
@ 2008-04-30 20:04 Glauber Costa
  2008-05-03 23:45 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Glauber Costa @ 2008-04-30 20:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm-devel

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(-)

diff --git a/cpu-all.h b/cpu-all.h
index 2a2b197..1c9e2a3 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -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)
 {
-- 
1.5.0.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] use common code for i386 and x86_64
  2008-04-30 20:04 [Qemu-devel] [PATCH] use common code for i386 and x86_64 Glauber Costa
@ 2008-05-03 23:45 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2008-05-03 23:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm-devel

On Wed, Apr 30, 2008 at 05:04:19PM -0300, Glauber Costa wrote:
> 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).

> ---
>  cpu-all.h |   11 +----------
>  1 files changed, 1 insertions(+), 10 deletions(-)
> 
> diff --git a/cpu-all.h b/cpu-all.h
> index 2a2b197..1c9e2a3 100644
> --- a/cpu-all.h
> +++ b/cpu-all.h
> @@ -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)
>  {
> -- 
> 1.5.0.6
> 
> 
> 
> 

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-03 23:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30 20:04 [Qemu-devel] [PATCH] use common code for i386 and x86_64 Glauber Costa
2008-05-03 23:45 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).