diff options
Diffstat (limited to 'include/asm-um/pgtable-3level.h')
-rw-r--r-- | include/asm-um/pgtable-3level.h | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h index aa82b88db805..0446f456b428 100644 --- a/include/asm-um/pgtable-3level.h +++ b/include/asm-um/pgtable-3level.h | |||
@@ -11,7 +11,11 @@ | |||
11 | 11 | ||
12 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ | 12 | /* PGDIR_SHIFT determines what a third-level page table entry can map */ |
13 | 13 | ||
14 | #ifdef CONFIG_64BIT | ||
14 | #define PGDIR_SHIFT 30 | 15 | #define PGDIR_SHIFT 30 |
16 | #else | ||
17 | #define PGDIR_SHIFT 31 | ||
18 | #endif | ||
15 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | 19 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
16 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | 20 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
17 | 21 | ||
@@ -28,9 +32,15 @@ | |||
28 | */ | 32 | */ |
29 | 33 | ||
30 | #define PTRS_PER_PTE 512 | 34 | #define PTRS_PER_PTE 512 |
35 | #ifdef CONFIG_64BIT | ||
31 | #define PTRS_PER_PMD 512 | 36 | #define PTRS_PER_PMD 512 |
32 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | ||
33 | #define PTRS_PER_PGD 512 | 37 | #define PTRS_PER_PGD 512 |
38 | #else | ||
39 | #define PTRS_PER_PMD 1024 | ||
40 | #define PTRS_PER_PGD 1024 | ||
41 | #endif | ||
42 | |||
43 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | ||
34 | #define FIRST_USER_ADDRESS 0 | 44 | #define FIRST_USER_ADDRESS 0 |
35 | 45 | ||
36 | #define pte_ERROR(e) \ | 46 | #define pte_ERROR(e) \ |
@@ -49,7 +59,12 @@ | |||
49 | #define pud_populate(mm, pud, pmd) \ | 59 | #define pud_populate(mm, pud, pmd) \ |
50 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) | 60 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) |
51 | 61 | ||
62 | #ifdef CONFIG_64BIT | ||
52 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) | 63 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) |
64 | #else | ||
65 | #define set_pud(pudptr, pudval) (*(pudptr) = (pudval)) | ||
66 | #endif | ||
67 | |||
53 | static inline int pgd_newpage(pgd_t pgd) | 68 | static inline int pgd_newpage(pgd_t pgd) |
54 | { | 69 | { |
55 | return(pgd_val(pgd) & _PAGE_NEWPAGE); | 70 | return(pgd_val(pgd) & _PAGE_NEWPAGE); |
@@ -57,26 +72,22 @@ static inline int pgd_newpage(pgd_t pgd) | |||
57 | 72 | ||
58 | static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } | 73 | static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } |
59 | 74 | ||
75 | #ifdef CONFIG_64BIT | ||
60 | #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) | 76 | #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) |
77 | #else | ||
78 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) | ||
79 | #endif | ||
61 | 80 | ||
62 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | 81 | struct mm_struct; |
63 | { | 82 | extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); |
64 | pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); | ||
65 | |||
66 | if(pmd) | ||
67 | memset(pmd, 0, PAGE_SIZE); | ||
68 | |||
69 | return pmd; | ||
70 | } | ||
71 | 83 | ||
72 | static inline void pud_clear (pud_t *pud) | 84 | static inline void pud_clear (pud_t *pud) |
73 | { | 85 | { |
74 | set_pud(pud, __pud(0)); | 86 | set_pud(pud, __pud(_PAGE_NEWPAGE)); |
75 | } | 87 | } |
76 | 88 | ||
77 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) | 89 | #define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK) |
78 | #define pud_page_vaddr(pud) \ | 90 | #define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK)) |
79 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) | ||
80 | 91 | ||
81 | /* Find an entry in the second-level page table.. */ | 92 | /* Find an entry in the second-level page table.. */ |
82 | #define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ | 93 | #define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \ |