Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80500
b: refs/heads/master
c: 8192206
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Jan 30, 2008
1 parent 0f38bd9 commit a643fdb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 687c4825b6ccab69b85f266ae925500b27aab6c2
refs/heads/master: 8192206df093e8fc607b5072ce71a930d44f8638
13 changes: 8 additions & 5 deletions trunk/arch/x86/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Thanks to Ben LaHaise for precious feedback.
*/
#include <linux/highmem.h>
#include <linux/bootmem.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -144,13 +145,15 @@ static int split_large_page(pte_t *kpte, unsigned long address)
}

static int
__change_page_attr(unsigned long address, struct page *page, pgprot_t prot)
__change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot)
{
struct page *kpte_page;
int level, err = 0;
pte_t *kpte;

BUG_ON(PageHighMem(page));
#ifdef CONFIG_X86_32
BUG_ON(pfn > max_low_pfn);
#endif

repeat:
kpte = lookup_address(address, &level);
Expand All @@ -164,7 +167,7 @@ __change_page_attr(unsigned long address, struct page *page, pgprot_t prot)
prot = check_exec(prot, address);

if (level == PG_LEVEL_4K) {
set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot)));
set_pte_atomic(kpte, pfn_pte(pfn, canon_pgprot(prot)));
} else {
err = split_large_page(kpte, address);
if (!err)
Expand Down Expand Up @@ -203,7 +206,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
unsigned long pfn = __pa(address) >> PAGE_SHIFT;

if (!kernel_map || pte_present(pfn_pte(0, prot))) {
err = __change_page_attr(address, pfn_to_page(pfn), prot);
err = __change_page_attr(address, pfn, prot);
if (err)
break;
}
Expand All @@ -219,7 +222,7 @@ int change_page_attr_addr(unsigned long address, int numpages, pgprot_t prot)
addr2 = __START_KERNEL_map + __pa(address);
/* Make sure the kernel mappings stay executable */
prot2 = pte_pgprot(pte_mkexec(pfn_pte(0, prot)));
err = __change_page_attr(addr2, pfn_to_page(pfn), prot2);
err = __change_page_attr(addr2, pfn, prot2);
}
#endif
}
Expand Down

0 comments on commit a643fdb

Please sign in to comment.