public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] x86: shift bits the right way in native_read_tscp
@ 2008-06-25 21:45 Max Asbock
  2008-06-25 21:51 ` Glauber Costa
  0 siblings, 1 reply; 2+ messages in thread
From: Max Asbock @ 2008-06-25 21:45 UTC (permalink / raw)
  To: gcosta, tglx, mingo, hpa; +Cc: linux-kernel

native_read_tscp shifts the bits in the high order value in the wrong direction,
the attached patch fixes that. 

Signed-off-by: Max Asbock <masbock@linux.vnet.ibm.com>

diff -pburN linux/include/asm-x86/msr.h linux.rdtscp/include/asm-x86/msr.h
--- linux/include/asm-x86/msr.h	2008-06-20 11:51:17.000000000 -0700
+++ linux.rdtscp/include/asm-x86/msr.h	2008-06-25 14:26:35.000000000 -0700
@@ -18,7 +18,7 @@ static inline unsigned long long native_
 	unsigned long low, high;
 	asm volatile(".byte 0x0f,0x01,0xf9"
 		     : "=a" (low), "=d" (high), "=c" (*aux));
-	return low | ((u64)high >> 32);
+	return low | ((u64)high << 32);
 }
 
 /*


---
Max



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

* Re: [patch] x86: shift bits the right way in native_read_tscp
  2008-06-25 21:45 [patch] x86: shift bits the right way in native_read_tscp Max Asbock
@ 2008-06-25 21:51 ` Glauber Costa
  0 siblings, 0 replies; 2+ messages in thread
From: Glauber Costa @ 2008-06-25 21:51 UTC (permalink / raw)
  To: Max Asbock; +Cc: tglx, mingo, hpa, linux-kernel

Max Asbock wrote:
> native_read_tscp shifts the bits in the high order value in the wrong direction,
> the attached patch fixes that. 
> 
> Signed-off-by: Max Asbock <masbock@linux.vnet.ibm.com>
> 
> diff -pburN linux/include/asm-x86/msr.h linux.rdtscp/include/asm-x86/msr.h
> --- linux/include/asm-x86/msr.h	2008-06-20 11:51:17.000000000 -0700
> +++ linux.rdtscp/include/asm-x86/msr.h	2008-06-25 14:26:35.000000000 -0700
> @@ -18,7 +18,7 @@ static inline unsigned long long native_
>  	unsigned long low, high;
>  	asm volatile(".byte 0x0f,0x01,0xf9"
>  		     : "=a" (low), "=d" (high), "=c" (*aux));
> -	return low | ((u64)high >> 32);
> +	return low | ((u64)high << 32);
>  }
>  
>  /*
> 
> 
> ---
> Max
> 
> 
uh-oh!

absolutely right

shame on me.

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

end of thread, other threads:[~2008-06-25 21:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-25 21:45 [patch] x86: shift bits the right way in native_read_tscp Max Asbock
2008-06-25 21:51 ` Glauber Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox