summaryrefslogtreecommitdiffstats
path: root/include/asm-x86_64/system.h
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2007-05-02 19:27:06 +0200
committerAndi Kleen <andi@basil.nowhere.org>2007-05-02 19:27:06 +0200
commitfbc16f2c2a0e16dbd75ac85d3b6db97f92b642ba (patch)
tree8d9e66b4ae5d9df1a18ec74d5a5f1ede8d806e15 /include/asm-x86_64/system.h
parentf9d09645d6157fefa18ff75930737060c8092ddb (diff)
downloadop-kernel-dev-fbc16f2c2a0e16dbd75ac85d3b6db97f92b642ba.zip
op-kernel-dev-fbc16f2c2a0e16dbd75ac85d3b6db97f92b642ba.tar.gz
[PATCH] x86-64: Remove duplicated code for reading control registers
On Tue, Mar 13, 2007 at 05:33:09AM -0700, Randy.Dunlap wrote: > On Tue, 13 Mar 2007, Glauber de Oliveira Costa wrote: > > > Tiny cleanup: > > > > In x86_64, the same functions for reading cr3 and writing cr{3,4} are > > defined in tlbflush.h and system.h, whith just a name change. > > The only difference is the clobbering of memory, which seems a safe, and > > even needed change for the write_cr4. This patch removes the duplicate. > > write_cr3() is moved to system.h for consistency. > > missing patch..... > thanks. Attached now -- Glauber de Oliveira Costa Red Hat Inc. "Free as in Freedom" Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'include/asm-x86_64/system.h')
-rw-r--r--include/asm-x86_64/system.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
index bd376bc..213b7fe 100644
--- a/include/asm-x86_64/system.h
+++ b/include/asm-x86_64/system.h
@@ -89,6 +89,11 @@ static inline unsigned long read_cr3(void)
return cr3;
}
+static inline void write_cr3(unsigned long val)
+{
+ asm volatile("movq %0,%%cr3" :: "r" (val) : "memory");
+}
+
static inline unsigned long read_cr4(void)
{
unsigned long cr4;
@@ -98,7 +103,7 @@ static inline unsigned long read_cr4(void)
static inline void write_cr4(unsigned long val)
{
- asm volatile("movq %0,%%cr4" :: "r" (val));
+ asm volatile("movq %0,%%cr4" :: "r" (val) : "memory");
}
#define stts() write_cr0(8 | read_cr0())
OpenPOWER on IntegriCloud