diff options
Diffstat (limited to 'include/asm-sh/pgalloc.h')
-rw-r--r-- | include/asm-sh/pgalloc.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/asm-sh/pgalloc.h b/include/asm-sh/pgalloc.h index e841465ab4d2..888e4529e6fe 100644 --- a/include/asm-sh/pgalloc.h +++ b/include/asm-sh/pgalloc.h | |||
@@ -1,13 +1,16 @@ | |||
1 | #ifndef __ASM_SH_PGALLOC_H | 1 | #ifndef __ASM_SH_PGALLOC_H |
2 | #define __ASM_SH_PGALLOC_H | 2 | #define __ASM_SH_PGALLOC_H |
3 | 3 | ||
4 | #define pmd_populate_kernel(mm, pmd, pte) \ | 4 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, |
5 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) | 5 | pte_t *pte) |
6 | { | ||
7 | set_pmd(pmd, __pmd((unsigned long)pte)); | ||
8 | } | ||
6 | 9 | ||
7 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | 10 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, |
8 | struct page *pte) | 11 | struct page *pte) |
9 | { | 12 | { |
10 | set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); | 13 | set_pmd(pmd, __pmd((unsigned long)page_address(pte))); |
11 | } | 14 | } |
12 | 15 | ||
13 | /* | 16 | /* |
@@ -15,7 +18,16 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
15 | */ | 18 | */ |
16 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) | 19 | static inline pgd_t *pgd_alloc(struct mm_struct *mm) |
17 | { | 20 | { |
18 | return (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO); | 21 | pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT); |
22 | |||
23 | if (pgd) { | ||
24 | memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); | ||
25 | memcpy(pgd + USER_PTRS_PER_PGD, | ||
26 | swapper_pg_dir + USER_PTRS_PER_PGD, | ||
27 | (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); | ||
28 | } | ||
29 | |||
30 | return pgd; | ||
19 | } | 31 | } |
20 | 32 | ||
21 | static inline void pgd_free(pgd_t *pgd) | 33 | static inline void pgd_free(pgd_t *pgd) |