Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#ifndef __ASM_SH_PGALLOC_H
2#define __ASM_SH_PGALLOC_H
3
4#define pmd_populate_kernel(mm, pmd, pte) \
5 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
6
7static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
8 struct page *pte)
9{
10 set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte)));
11}
12
13/*
14 * Allocate and free page tables.
15 */
16static inline pgd_t *pgd_alloc(struct mm_struct *mm)
17{
18 return (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
19}
20
21static inline void pgd_free(pgd_t *pgd)
22{
23 free_page((unsigned long)pgd);
24}
25
26static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
27 unsigned long address)
28{
29 return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
30}
31
32static inline struct page *pte_alloc_one(struct mm_struct *mm,
33 unsigned long address)
34{
35 return alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
36}
37
38static inline void pte_free_kernel(pte_t *pte)
39{
40 free_page((unsigned long)pte);
41}
42
43static inline void pte_free(struct page *pte)
44{
45 __free_page(pte);
46}
47
48#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
49
50/*
51 * allocating and freeing a pmd is trivial: the 1-entry pmd is
52 * inside the pgd, so has no extra memory associated with it.
53 */
54
55#define pmd_free(x) do { } while (0)
56#define __pmd_free_tlb(tlb,x) do { } while (0)
57#define check_pgt_cache() do { } while (0)
58
59#endif /* __ASM_SH_PGALLOC_H */