ia64/xen-unstable

changeset 6091:7c9513a80026

Fix time handling on x86/64.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Aug 10 12:56:47 2005 +0000 (2005-08-10)
parents 50e57636bdd8
children 5dae4ecedb0c
files linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c xen/arch/x86/time.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Wed Aug 10 12:21:39 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Wed Aug 10 12:56:47 2005 +0000
     1.3 @@ -173,13 +173,16 @@ struct timer_opts timer_tsc = {
     1.4  static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
     1.5  {
     1.6  	u64 product;
     1.7 +#ifdef __i386__
     1.8  	u32 tmp1, tmp2;
     1.9 +#endif
    1.10  
    1.11  	if ( shift < 0 )
    1.12  		delta >>= -shift;
    1.13  	else
    1.14  		delta <<= shift;
    1.15  
    1.16 +#ifdef __i386__
    1.17  	__asm__ (
    1.18  		"mul  %5       ; "
    1.19  		"mov  %4,%%eax ; "
    1.20 @@ -190,6 +193,11 @@ static inline u64 scale_delta(u64 delta,
    1.21  		"adc  %5,%%edx ; "
    1.22  		: "=A" (product), "=r" (tmp1), "=r" (tmp2)
    1.23  		: "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
    1.24 +#else
    1.25 +	__asm__ (
    1.26 +		"mul %%rdx ; shrd $32,%%rdx,%%rax"
    1.27 +		: "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
    1.28 +#endif
    1.29  
    1.30  	return product;
    1.31  }
     2.1 --- a/xen/arch/x86/time.c	Wed Aug 10 12:21:39 2005 +0000
     2.2 +++ b/xen/arch/x86/time.c	Wed Aug 10 12:56:47 2005 +0000
     2.3 @@ -103,13 +103,16 @@ static inline u32 mul_frac(u32 multiplic
     2.4  static inline u64 scale_delta(u64 delta, struct time_scale *scale)
     2.5  {
     2.6      u64 product;
     2.7 +#ifdef CONFIG_x86_32
     2.8      u32 tmp1, tmp2;
     2.9 +#endif
    2.10  
    2.11      if ( scale->shift < 0 )
    2.12          delta >>= -scale->shift;
    2.13      else
    2.14          delta <<= scale->shift;
    2.15  
    2.16 +#ifdef CONFIG_X86_32
    2.17      __asm__ (
    2.18          "mul  %5       ; "
    2.19          "mov  %4,%%eax ; "
    2.20 @@ -120,6 +123,11 @@ static inline u64 scale_delta(u64 delta,
    2.21          "adc  %5,%%edx ; "
    2.22          : "=A" (product), "=r" (tmp1), "=r" (tmp2)
    2.23          : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) );
    2.24 +#else
    2.25 +    __asm__ (
    2.26 +        "mul %%rdx ; shrd $32,%%rdx,%%rax"
    2.27 +        : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) );
    2.28 +#endif
    2.29  
    2.30      return product;
    2.31  }