diff options
-rw-r--r-- | include/asm-x86_64/system.h | 7 | ||||
-rw-r--r-- | include/asm-x86_64/tlbflush.h | 33 |
2 files changed, 11 insertions, 29 deletions
diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index bd376bc8c4ab..213b7fe5d998 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) | |||
89 | return cr3; | 89 | return cr3; |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void write_cr3(unsigned long val) | ||
93 | { | ||
94 | asm volatile("movq %0,%%cr3" :: "r" (val) : "memory"); | ||
95 | } | ||
96 | |||
92 | static inline unsigned long read_cr4(void) | 97 | static inline unsigned long read_cr4(void) |
93 | { | 98 | { |
94 | unsigned long cr4; | 99 | unsigned long cr4; |
@@ -98,7 +103,7 @@ static inline unsigned long read_cr4(void) | |||
98 | 103 | ||
99 | static inline void write_cr4(unsigned long val) | 104 | static inline void write_cr4(unsigned long val) |
100 | { | 105 | { |
101 | asm volatile("movq %0,%%cr4" :: "r" (val)); | 106 | asm volatile("movq %0,%%cr4" :: "r" (val) : "memory"); |
102 | } | 107 | } |
103 | 108 | ||
104 | #define stts() write_cr0(8 | read_cr0()) | 109 | #define stts() write_cr0(8 | read_cr0()) |
diff --git a/include/asm-x86_64/tlbflush.h b/include/asm-x86_64/tlbflush.h index 983bd296c81a..512401b8725f 100644 --- a/include/asm-x86_64/tlbflush.h +++ b/include/asm-x86_64/tlbflush.h | |||
@@ -3,41 +3,18 @@ | |||
3 | 3 | ||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <asm/processor.h> | 5 | #include <asm/processor.h> |
6 | 6 | #include <asm/system.h> | |
7 | static inline unsigned long get_cr3(void) | ||
8 | { | ||
9 | unsigned long cr3; | ||
10 | asm volatile("mov %%cr3,%0" : "=r" (cr3)); | ||
11 | return cr3; | ||
12 | } | ||
13 | |||
14 | static inline void set_cr3(unsigned long cr3) | ||
15 | { | ||
16 | asm volatile("mov %0,%%cr3" :: "r" (cr3) : "memory"); | ||
17 | } | ||
18 | 7 | ||
19 | static inline void __flush_tlb(void) | 8 | static inline void __flush_tlb(void) |
20 | { | 9 | { |
21 | set_cr3(get_cr3()); | 10 | write_cr3(read_cr3()); |
22 | } | ||
23 | |||
24 | static inline unsigned long get_cr4(void) | ||
25 | { | ||
26 | unsigned long cr4; | ||
27 | asm volatile("mov %%cr4,%0" : "=r" (cr4)); | ||
28 | return cr4; | ||
29 | } | ||
30 | |||
31 | static inline void set_cr4(unsigned long cr4) | ||
32 | { | ||
33 | asm volatile("mov %0,%%cr4" :: "r" (cr4) : "memory"); | ||
34 | } | 11 | } |
35 | 12 | ||
36 | static inline void __flush_tlb_all(void) | 13 | static inline void __flush_tlb_all(void) |
37 | { | 14 | { |
38 | unsigned long cr4 = get_cr4(); | 15 | unsigned long cr4 = read_cr4(); |
39 | set_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */ | 16 | write_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */ |
40 | set_cr4(cr4); /* write old PGE again and flush TLBs */ | 17 | write_cr4(cr4); /* write old PGE again and flush TLBs */ |
41 | } | 18 | } |
42 | 19 | ||
43 | #define __flush_tlb_one(addr) \ | 20 | #define __flush_tlb_one(addr) \ |