diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:43 -0500 |
commit | f0646e43acb18f0e00b00085dc88bc3f403e7930 (patch) | |
tree | c47968a44ac541854929f03d22cf2fb76d76cb55 /arch/x86/mm/pageattr_64.c | |
parent | a5a5dc31794c3271c066835ad2c90c58a3805569 (diff) |
x86: return the page table level in lookup_address()
based on this patch from Andi Kleen:
| Subject: CPA: Return the page table level in lookup_address()
| From: Andi Kleen <ak@suse.de>
|
| Needed for the next change.
|
| And change all the callers.
and ported it to x86.git.
Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pageattr_64.c')
-rw-r--r-- | arch/x86/mm/pageattr_64.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/mm/pageattr_64.c b/arch/x86/mm/pageattr_64.c index 14ab327cde0c..59cd066f6741 100644 --- a/arch/x86/mm/pageattr_64.c +++ b/arch/x86/mm/pageattr_64.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | 16 | ||
17 | pte_t *lookup_address(unsigned long address) | 17 | pte_t *lookup_address(unsigned long address, int *level) |
18 | { | 18 | { |
19 | pgd_t *pgd = pgd_offset_k(address); | 19 | pgd_t *pgd = pgd_offset_k(address); |
20 | pud_t *pud; | 20 | pud_t *pud; |
@@ -29,8 +29,10 @@ pte_t *lookup_address(unsigned long address) | |||
29 | pmd = pmd_offset(pud, address); | 29 | pmd = pmd_offset(pud, address); |
30 | if (!pmd_present(*pmd)) | 30 | if (!pmd_present(*pmd)) |
31 | return NULL; | 31 | return NULL; |
32 | *level = 3; | ||
32 | if (pmd_large(*pmd)) | 33 | if (pmd_large(*pmd)) |
33 | return (pte_t *)pmd; | 34 | return (pte_t *)pmd; |
35 | *level = 4; | ||
34 | 36 | ||
35 | pte = pte_offset_kernel(pmd, address); | 37 | pte = pte_offset_kernel(pmd, address); |
36 | if (pte && !pte_present(*pte)) | 38 | if (pte && !pte_present(*pte)) |
@@ -140,8 +142,9 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot, | |||
140 | struct page *kpte_page; | 142 | struct page *kpte_page; |
141 | pgprot_t ref_prot2; | 143 | pgprot_t ref_prot2; |
142 | pte_t *kpte; | 144 | pte_t *kpte; |
145 | int level; | ||
143 | 146 | ||
144 | kpte = lookup_address(address); | 147 | kpte = lookup_address(address, &level); |
145 | if (!kpte) | 148 | if (!kpte) |
146 | return 0; | 149 | return 0; |
147 | 150 | ||