aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-01-30 07:34:04 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:04 -0500
commit30551bb3ce9257a2352b3cb4e45010d415cc0ad5 (patch)
treeedcf2a24fc689ecb4a0420c0d555d042002ecacf /arch
parent0a663088cd6ff9e89f285ae7689e6eee46cfb54c (diff)
x86: add PG_LEVEL enum
this way PG_LEVEL_1GB will be an easy change. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/mm/pageattr-test.c4
-rw-r--r--arch/x86/mm/pageattr.c9
2 files changed, 7 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
17enum { 17enum {
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);