1 #ifndef __ASM_SH_PGALLOC_H
2 #define __ASM_SH_PGALLOC_H
4 static inline void pmd_populate_kernel(struct mm_struct
*mm
, pmd_t
*pmd
,
7 set_pmd(pmd
, __pmd((unsigned long)pte
));
10 static inline void pmd_populate(struct mm_struct
*mm
, pmd_t
*pmd
,
13 set_pmd(pmd
, __pmd((unsigned long)page_address(pte
)));
17 * Allocate and free page tables.
19 static inline pgd_t
*pgd_alloc(struct mm_struct
*mm
)
21 pgd_t
*pgd
= (pgd_t
*)__get_free_page(GFP_KERNEL
| __GFP_REPEAT
);
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
));
33 static inline void pgd_free(pgd_t
*pgd
)
35 free_page((unsigned long)pgd
);
38 static inline pte_t
*pte_alloc_one_kernel(struct mm_struct
*mm
,
39 unsigned long address
)
41 return (pte_t
*)__get_free_page(GFP_KERNEL
| __GFP_REPEAT
| __GFP_ZERO
);
44 static inline struct page
*pte_alloc_one(struct mm_struct
*mm
,
45 unsigned long address
)
47 return alloc_page(GFP_KERNEL
| __GFP_REPEAT
| __GFP_ZERO
);
50 static inline void pte_free_kernel(pte_t
*pte
)
52 free_page((unsigned long)pte
);
55 static inline void pte_free(struct page
*pte
)
60 #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
63 * allocating and freeing a pmd is trivial: the 1-entry pmd is
64 * inside the pgd, so has no extra memory associated with it.
67 #define pmd_free(x) do { } while (0)
68 #define __pmd_free_tlb(tlb,x) do { } while (0)
69 #define check_pgt_cache() do { } while (0)
71 #endif /* __ASM_SH_PGALLOC_H */