]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: add PG_LEVEL enum
authorThomas Gleixner <tglx@linutronix.de>
Wed, 30 Jan 2008 12:34:04 +0000 (13:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:34:04 +0000 (13:34 +0100)
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>
arch/x86/mm/pageattr-test.c
arch/x86/mm/pageattr.c
include/asm-x86/pgtable.h

index 6cc106b388a5620a31d3030b2bba6b593142745b..d7a93008cc12ec5598d28fc9cfd9c8e72601b3dc 100644 (file)
 
 enum {
        NTEST                   = 400,
+       LOWEST_LEVEL            = PG_LEVEL_4K,
 #ifdef CONFIG_X86_64
-       LOWEST_LEVEL            = 4,
        LPS                     = (1 << PMD_SHIFT),
 #elif defined(CONFIG_X86_PAE)
-       LOWEST_LEVEL            = 4,
        LPS                     = (1 << PMD_SHIFT),
 #else
-       LOWEST_LEVEL            = 4, /* lookup_address lies here */
        LPS                     = (1 << 22),
 #endif
        GPS                     = (1<<30)
index a270f9ccebfb004bd98238df6405943b10865ed7..4589a1382fa1cb14902ed4e6a8634648adac31cf 100644 (file)
@@ -28,6 +28,8 @@ pte_t *lookup_address(unsigned long address, int *level)
        pud_t *pud;
        pmd_t *pmd;
 
+       *level = PG_LEVEL_NONE;
+
        if (pgd_none(*pgd))
                return NULL;
        pud = pud_offset(pgd, address);
@@ -36,11 +38,12 @@ pte_t *lookup_address(unsigned long address, int *level)
        pmd = pmd_offset(pud, address);
        if (pmd_none(*pmd))
                return NULL;
-       *level = 3;
+
+       *level = PG_LEVEL_2M;
        if (pmd_large(*pmd))
                return (pte_t *)pmd;
-       *level = 4;
 
+       *level = PG_LEVEL_4K;
        return pte_offset_kernel(pmd, address);
 }
 
@@ -145,7 +148,7 @@ repeat:
                address < (unsigned long)&_etext &&
               (pgprot_val(prot) & _PAGE_NX));
 
-       if (level == 4) {
+       if (level == PG_LEVEL_4K) {
                set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot)));
        } else {
                err = split_large_page(kpte, address);
index 4409dabe31c61cf30002b4da56482d05318c686b..7aa34c8eb22052538304275a4356bb4fd9ad1450 100644 (file)
@@ -234,6 +234,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 
 #ifndef __ASSEMBLY__
 
+enum {
+       PG_LEVEL_NONE,
+       PG_LEVEL_4K,
+       PG_LEVEL_2M,
+};
+
 /*
  * Helper function that returns the kernel pagetable entry controlling
  * the virtual address 'address'. NULL means no pagetable entry present.