diff options
author | Stuart Menefy <stuart.menefy@st.com> | 2006-11-21 01:38:05 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-12-05 20:45:38 -0500 |
commit | 99a596f93be10001c50894bcab69e458a49a3b8c (patch) | |
tree | 16faf593cc3f7a2c39f3079f0f64f410e530e1c4 /include/asm-sh/pgalloc.h | |
parent | 6e4662ff49c6b94e16a47bfddb920576963b5a20 (diff) |
sh: pmd rework.
Remove extra bits from the pmd structure and store a kernel logical
address rather than a physical address. This allows it to be directly
dereferenced. Another piece of wierdness inherited from x86.
Signed-off-by: Stuart Menefy <stuart.menefy@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
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) |