aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/pgalloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-arm/pgalloc.h')
-rw-r--r--include/asm-arm/pgalloc.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/include/asm-arm/pgalloc.h b/include/asm-arm/pgalloc.h
index e814f8144f8b..bc18ff405181 100644
--- a/include/asm-arm/pgalloc.h
+++ b/include/asm-arm/pgalloc.h
@@ -89,6 +89,13 @@ static inline void pte_free(struct page *pte)
89 __free_page(pte); 89 __free_page(pte);
90} 90}
91 91
92static inline void __pmd_populate(pmd_t *pmdp, unsigned long pmdval)
93{
94 pmdp[0] = __pmd(pmdval);
95 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
96 flush_pmd_entry(pmdp);
97}
98
92/* 99/*
93 * Populate the pmdp entry with a pointer to the pte. This pmd is part 100 * Populate the pmdp entry with a pointer to the pte. This pmd is part
94 * of the mm address space. 101 * of the mm address space.
@@ -99,32 +106,19 @@ static inline void
99pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) 106pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
100{ 107{
101 unsigned long pte_ptr = (unsigned long)ptep; 108 unsigned long pte_ptr = (unsigned long)ptep;
102 unsigned long pmdval;
103
104 BUG_ON(mm != &init_mm);
105 109
106 /* 110 /*
107 * The pmd must be loaded with the physical 111 * The pmd must be loaded with the physical
108 * address of the PTE table 112 * address of the PTE table
109 */ 113 */
110 pte_ptr -= PTRS_PER_PTE * sizeof(void *); 114 pte_ptr -= PTRS_PER_PTE * sizeof(void *);
111 pmdval = __pa(pte_ptr) | _PAGE_KERNEL_TABLE; 115 __pmd_populate(pmdp, __pa(pte_ptr) | _PAGE_KERNEL_TABLE);
112 pmdp[0] = __pmd(pmdval);
113 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
114 flush_pmd_entry(pmdp);
115} 116}
116 117
117static inline void 118static inline void
118pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep) 119pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
119{ 120{
120 unsigned long pmdval; 121 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE);
121
122 BUG_ON(mm == &init_mm);
123
124 pmdval = page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE;
125 pmdp[0] = __pmd(pmdval);
126 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
127 flush_pmd_entry(pmdp);
128} 122}
129 123
130#endif 124#endif