aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pageattr.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:34:04 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:04 -0500
commit8192206df093e8fc607b5072ce71a930d44f8638 (patch)
tree49f6c9cf218537788615bb755595cbdd44c1ae41 /arch/x86/mm/pageattr.c
parent687c4825b6ccab69b85f266ae925500b27aab6c2 (diff)
x86: change cpa to pfn based
change CPA to pfn based. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pageattr.c')
-rw-r--r--arch/x86/mm/pageattr.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index effcd78d5f40..d18c41d752f3 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -3,6 +3,7 @@
3 * Thanks to Ben LaHaise for precious feedback. 3 * Thanks to Ben LaHaise for precious feedback.
4 */ 4 */
5#include <linux/highmem.h> 5#include <linux/highmem.h>
6#include <linux/bootmem.h>
6#include <linux/module.h> 7#include <linux/module.h>
7#include <linux/sched.h> 8#include <linux/sched.h>
8#include <linux/slab.h> 9#include <linux/slab.h>
@@ -144,13 +145,15 @@ out_unlock:
144} 145}
145 146
146static int 147static int
147__change_page_attr(unsigned long address, struct page *page, pgprot_t prot) 148__change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot)
148{ 149{
149 struct page *kpte_page; 150 struct page *kpte_page;
150 int level, err = 0; 151 int level, err = 0;
151 pte_t *kpte; 152 pte_t *kpte;
152 153
153 BUG_ON(PageHighMem(page)); 154#ifdef CONFIG_X86_32
155 BUG_ON(pfn > max_low_pfn);
156#endif
154 157
155repeat: 158repeat:
156 kpte = lookup_address(address, &level); 159 kpte = lookup_address(address, &level);
@@ -164,7 +167,7 @@ repeat:
164 prot = check_exec(prot, address); 167 prot = check_exec(prot, address);
165 168
166 if (level == PG_LEVEL_4K) { 169 if (level == PG_LEVEL_4K) {
167 set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot))); 170 set_pte_atomic(kpte, pfn_pte(pfn, canon_pgprot(prot)));
168 } else { 171 } else {
169 err = split_large_page(kpte, address); 172 err = split_large_page(kpte, address);
170 if (!err) 173 if (!err)
@@ -203,7 +206,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
203 unsigned long pfn = __pa(address) >> PAGE_SHIFT; 206 unsigned long pfn = __pa(address) >> PAGE_SHIFT;
204 207
205 if (!kernel_map || pte_present(pfn_pte(0, prot))) { 208 if (!kernel_map || pte_present(pfn_pte(0, prot))) {
206 err = __change_page_attr(address, pfn_to_page(pfn), prot); 209 err = __change_page_attr(address, pfn, prot);
207 if (err) 210 if (err)
208 break; 211 break;
209 } 212 }
@@ -219,7 +222,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
219 addr2 = __START_KERNEL_map + __pa(address); 222 addr2 = __START_KERNEL_map + __pa(address);
220 /* Make sure the kernel mappings stay executable */ 223 /* Make sure the kernel mappings stay executable */
221 prot2 = pte_pgprot(pte_mkexec(pfn_pte(0, prot))); 224 prot2 = pte_pgprot(pte_mkexec(pfn_pte(0, prot)));
222 err = __change_page_attr(addr2, pfn_to_page(pfn), prot2); 225 err = __change_page_attr(addr2, pfn, prot2);
223 } 226 }
224#endif 227#endif
225 } 228 }