1 #ifndef _MOTOROLA_PGALLOC_H
2 #define _MOTOROLA_PGALLOC_H
5 #include <asm/tlbflush.h>
7 extern pmd_t
*get_pointer_table(void);
8 extern int free_pointer_table(pmd_t
*);
11 static inline pte_t
*pte_alloc_one_kernel(struct mm_struct
*mm
, unsigned long address
)
15 pte
= (pte_t
*)__get_free_page(GFP_KERNEL
|__GFP_REPEAT
|__GFP_ZERO
);
17 __flush_page_to_ram(pte
);
18 flush_tlb_kernel_page(pte
);
25 static inline void pte_free_kernel(pte_t
*pte
)
28 free_page((unsigned long) pte
);
31 static inline struct page
*pte_alloc_one(struct mm_struct
*mm
, unsigned long address
)
33 struct page
*page
= alloc_pages(GFP_KERNEL
|__GFP_REPEAT
|__GFP_ZERO
, 0);
41 __flush_page_to_ram(pte
);
42 flush_tlb_kernel_page(pte
);
50 static inline void pte_free(struct page
*page
)
52 cache_page(kmap(page
));
57 static inline void __pte_free_tlb(struct mmu_gather
*tlb
, struct page
*page
)
59 cache_page(kmap(page
));
65 static inline pmd_t
*pmd_alloc_one(struct mm_struct
*mm
, unsigned long address
)
67 return get_pointer_table();
70 static inline int pmd_free(pmd_t
*pmd
)
72 return free_pointer_table(pmd
);
75 static inline int __pmd_free_tlb(struct mmu_gather
*tlb
, pmd_t
*pmd
)
77 return free_pointer_table(pmd
);
81 static inline void pgd_free(pgd_t
*pgd
)
83 pmd_free((pmd_t
*)pgd
);
86 static inline pgd_t
*pgd_alloc(struct mm_struct
*mm
)
88 return (pgd_t
*)get_pointer_table();
92 static inline void pmd_populate_kernel(struct mm_struct
*mm
, pmd_t
*pmd
, pte_t
*pte
)
97 static inline void pmd_populate(struct mm_struct
*mm
, pmd_t
*pmd
, struct page
*page
)
99 pmd_set(pmd
, page_address(page
));
102 static inline void pgd_populate(struct mm_struct
*mm
, pgd_t
*pgd
, pmd_t
*pmd
)
107 #endif /* _MOTOROLA_PGALLOC_H */