diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-06-22 15:58:29 -0400 |
---|---|---|
committer | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-06-22 15:58:29 -0400 |
commit | bdf042486a01aefaf29d74be1b4526daa70a5f0f (patch) | |
tree | dd6af0dacd88d98eda7cd9ed80b89deec7157d7f /include/asm-arm/pgalloc.h | |
parent | e00d349e7781a92cf35b242259c9e5341a9661bb (diff) |
[PATCH] ARM: Factor out common pmd_populate functionality
Both pmd_populate variants set two pmd entries before
ensuring that they are flushed from the cache. Separate
this functionality into __pmd_populate().
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/asm-arm/pgalloc.h')
-rw-r--r-- | include/asm-arm/pgalloc.h | 24 |
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 | ||
92 | static 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 | |||
99 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep) | 106 | pmd_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 | ||
117 | static inline void | 118 | static inline void |
118 | pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep) | 119 | pmd_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 |