diff options
-rw-r--r-- | arch/x86/mm/pageattr-test.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/pageattr.c | 9 | ||||
-rw-r--r-- | include/asm-x86/pgtable.h | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index 6cc106b388a5..d7a93008cc12 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c | |||
@@ -16,14 +16,12 @@ | |||
16 | 16 | ||
17 | enum { | 17 | enum { |
18 | NTEST = 400, | 18 | NTEST = 400, |
19 | LOWEST_LEVEL = PG_LEVEL_4K, | ||
19 | #ifdef CONFIG_X86_64 | 20 | #ifdef CONFIG_X86_64 |
20 | LOWEST_LEVEL = 4, | ||
21 | LPS = (1 << PMD_SHIFT), | 21 | LPS = (1 << PMD_SHIFT), |
22 | #elif defined(CONFIG_X86_PAE) | 22 | #elif defined(CONFIG_X86_PAE) |
23 | LOWEST_LEVEL = 4, | ||
24 | LPS = (1 << PMD_SHIFT), | 23 | LPS = (1 << PMD_SHIFT), |
25 | #else | 24 | #else |
26 | LOWEST_LEVEL = 4, /* lookup_address lies here */ | ||
27 | LPS = (1 << 22), | 25 | LPS = (1 << 22), |
28 | #endif | 26 | #endif |
29 | GPS = (1<<30) | 27 | GPS = (1<<30) |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index a270f9ccebfb..4589a1382fa1 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -28,6 +28,8 @@ pte_t *lookup_address(unsigned long address, int *level) | |||
28 | pud_t *pud; | 28 | pud_t *pud; |
29 | pmd_t *pmd; | 29 | pmd_t *pmd; |
30 | 30 | ||
31 | *level = PG_LEVEL_NONE; | ||
32 | |||
31 | if (pgd_none(*pgd)) | 33 | if (pgd_none(*pgd)) |
32 | return NULL; | 34 | return NULL; |
33 | pud = pud_offset(pgd, address); | 35 | pud = pud_offset(pgd, address); |
@@ -36,11 +38,12 @@ pte_t *lookup_address(unsigned long address, int *level) | |||
36 | pmd = pmd_offset(pud, address); | 38 | pmd = pmd_offset(pud, address); |
37 | if (pmd_none(*pmd)) | 39 | if (pmd_none(*pmd)) |
38 | return NULL; | 40 | return NULL; |
39 | *level = 3; | 41 | |
42 | *level = PG_LEVEL_2M; | ||
40 | if (pmd_large(*pmd)) | 43 | if (pmd_large(*pmd)) |
41 | return (pte_t *)pmd; | 44 | return (pte_t *)pmd; |
42 | *level = 4; | ||
43 | 45 | ||
46 | *level = PG_LEVEL_4K; | ||
44 | return pte_offset_kernel(pmd, address); | 47 | return pte_offset_kernel(pmd, address); |
45 | } | 48 | } |
46 | 49 | ||
@@ -145,7 +148,7 @@ repeat: | |||
145 | address < (unsigned long)&_etext && | 148 | address < (unsigned long)&_etext && |
146 | (pgprot_val(prot) & _PAGE_NX)); | 149 | (pgprot_val(prot) & _PAGE_NX)); |
147 | 150 | ||
148 | if (level == 4) { | 151 | if (level == PG_LEVEL_4K) { |
149 | set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot))); | 152 | set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot))); |
150 | } else { | 153 | } else { |
151 | err = split_large_page(kpte, address); | 154 | err = split_large_page(kpte, address); |
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index 4409dabe31c6..7aa34c8eb220 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -234,6 +234,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
234 | 234 | ||
235 | #ifndef __ASSEMBLY__ | 235 | #ifndef __ASSEMBLY__ |
236 | 236 | ||
237 | enum { | ||
238 | PG_LEVEL_NONE, | ||
239 | PG_LEVEL_4K, | ||
240 | PG_LEVEL_2M, | ||
241 | }; | ||
242 | |||
237 | /* | 243 | /* |
238 | * Helper function that returns the kernel pagetable entry controlling | 244 | * Helper function that returns the kernel pagetable entry controlling |
239 | * the virtual address 'address'. NULL means no pagetable entry present. | 245 | * the virtual address 'address'. NULL means no pagetable entry present. |