1 #ifndef _I386_PGALLOC_H
2 #define _I386_PGALLOC_H
4 #include <linux/threads.h>
5 #include <linux/mm.h> /* for struct page */
7 #include <asm-generic/tlb.h>
10 #include <asm/paravirt.h>
12 #define paravirt_alloc_pt(mm, pfn) do { } while (0)
13 #define paravirt_alloc_pd(mm, pfn) do { } while (0)
14 #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
15 #define paravirt_release_pt(pfn) do { } while (0)
16 #define paravirt_release_pd(pfn) do { } while (0)
19 static inline void pmd_populate_kernel(struct mm_struct
*mm
,
20 pmd_t
*pmd
, pte_t
*pte
)
22 paravirt_alloc_pt(mm
, __pa(pte
) >> PAGE_SHIFT
);
23 set_pmd(pmd
, __pmd(__pa(pte
) | _PAGE_TABLE
));
26 static inline void pmd_populate(struct mm_struct
*mm
, pmd_t
*pmd
, struct page
*pte
)
28 unsigned long pfn
= page_to_pfn(pte
);
30 paravirt_alloc_pt(mm
, pfn
);
31 set_pmd(pmd
, __pmd(((pteval_t
)pfn
<< PAGE_SHIFT
) | _PAGE_TABLE
));
35 * Allocate and free page tables.
37 extern pgd_t
*pgd_alloc(struct mm_struct
*);
38 extern void pgd_free(pgd_t
*pgd
);
40 extern pte_t
*pte_alloc_one_kernel(struct mm_struct
*, unsigned long);
41 extern struct page
*pte_alloc_one(struct mm_struct
*, unsigned long);
43 static inline void pte_free_kernel(pte_t
*pte
)
45 free_page((unsigned long)pte
);
48 static inline void pte_free(struct page
*pte
)
54 static inline void __pte_free_tlb(struct mmu_gather
*tlb
, struct page
*pte
)
56 paravirt_release_pt(page_to_pfn(pte
));
57 tlb_remove_page(tlb
, pte
);
62 * In the PAE case we free the pmds as part of the pgd.
64 static inline pmd_t
*pmd_alloc_one(struct mm_struct
*mm
, unsigned long addr
)
70 static inline void pmd_free(pmd_t
*pmd
)
74 static inline void __pmd_free_tlb(struct mmu_gather
*tlb
, pmd_t
*pmd
)
78 static inline void pud_populate(struct mm_struct
*mm
, pud_t
*pud
, pmd_t
*pmd
)
82 #endif /* CONFIG_X86_PAE */
84 #endif /* _I386_PGALLOC_H */