diff options
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/mm/fault_32.c | 3 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 3 | ||||
-rw-r--r-- | arch/x86/mm/pageattr_32.c | 7 | ||||
-rw-r--r-- | arch/x86/mm/pageattr_64.c | 7 | ||||
-rw-r--r-- | arch/x86/xen/mmu.c | 9 |
5 files changed, 20 insertions, 9 deletions
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c index f7972ae7da0..f4f8c324715 100644 --- a/arch/x86/mm/fault_32.c +++ b/arch/x86/mm/fault_32.c @@ -613,7 +613,8 @@ no_context: #ifdef CONFIG_X86_PAE if (error_code & PF_INSTR) { - pte_t *pte = lookup_address(address); + int level; + pte_t *pte = lookup_address(address, &level); if (pte && pte_present(*pte) && !pte_exec(*pte)) printk(KERN_CRIT "kernel tried to execute " diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 5080646da77..206e3f6800b 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -535,11 +535,12 @@ int __init set_kernel_exec(unsigned long vaddr, int enable) { pte_t *pte; int ret = 1; + int level; if (!nx_enabled) goto out; - pte = lookup_address(vaddr); + pte = lookup_address(vaddr, &level); BUG_ON(!pte); if (!pte_exec(*pte)) diff --git a/arch/x86/mm/pageattr_32.c b/arch/x86/mm/pageattr_32.c index be4656403d7..523fd5b37df 100644 --- a/arch/x86/mm/pageattr_32.c +++ b/arch/x86/mm/pageattr_32.c @@ -18,7 +18,7 @@ static DEFINE_SPINLOCK(cpa_lock); static struct list_head df_list = LIST_HEAD_INIT(df_list); -pte_t *lookup_address(unsigned long address) +pte_t *lookup_address(unsigned long address, int *level) { pgd_t *pgd = pgd_offset_k(address); pud_t *pud; @@ -32,8 +32,10 @@ pte_t *lookup_address(unsigned long address) pmd = pmd_offset(pud, address); if (pmd_none(*pmd)) return NULL; + *level = 2; if (pmd_large(*pmd)) return (pte_t *)pmd; + *level = 3; return pte_offset_kernel(pmd, address); } @@ -156,11 +158,12 @@ static int __change_page_attr(struct page *page, pgprot_t prot) struct page *kpte_page; unsigned long address; pte_t *kpte; + int level; BUG_ON(PageHighMem(page)); address = (unsigned long)page_address(page); - kpte = lookup_address(address); + kpte = lookup_address(address, &level); if (!kpte) return -EINVAL; diff --git a/arch/x86/mm/pageattr_64.c b/arch/x86/mm/pageattr_64.c index 14ab327cde0..59cd066f674 100644 --- a/arch/x86/mm/pageattr_64.c +++ b/arch/x86/mm/pageattr_64.c @@ -14,7 +14,7 @@ #include <asm/uaccess.h> #include <asm/io.h> -pte_t *lookup_address(unsigned long address) +pte_t *lookup_address(unsigned long address, int *level) { pgd_t *pgd = pgd_offset_k(address); pud_t *pud; @@ -29,8 +29,10 @@ pte_t *lookup_address(unsigned long address) pmd = pmd_offset(pud, address); if (!pmd_present(*pmd)) return NULL; + *level = 3; if (pmd_large(*pmd)) return (pte_t *)pmd; + *level = 4; pte = pte_offset_kernel(pmd, address); if (pte && !pte_present(*pte)) @@ -140,8 +142,9 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, struct page *kpte_page; pgprot_t ref_prot2; pte_t *kpte; + int level; - kpte = lookup_address(address); + kpte = lookup_address(address, &level); if (!kpte) return 0; diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index e6184735545..45aa771e73a 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -58,7 +58,8 @@ xmaddr_t arbitrary_virt_to_machine(unsigned long address) { - pte_t *pte = lookup_address(address); + int level; + pte_t *pte = lookup_address(address, &level); unsigned offset = address & PAGE_MASK; BUG_ON(pte == NULL); @@ -70,8 +71,9 @@ void make_lowmem_page_readonly(void *vaddr) { pte_t *pte, ptev; unsigned long address = (unsigned long)vaddr; + int level; - pte = lookup_address(address); + pte = lookup_address(address, &level); BUG_ON(pte == NULL); ptev = pte_wrprotect(*pte); @@ -84,8 +86,9 @@ void make_lowmem_page_readwrite(void *vaddr) { pte_t *pte, ptev; unsigned long address = (unsigned long)vaddr; + int level; - pte = lookup_address(address); + pte = lookup_address(address, &level); BUG_ON(pte == NULL); ptev = pte_mkwrite(*pte); |