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
*);
10 static inline pte_t
*pte_alloc_one_kernel(struct mm_struct
*mm
, unsigned long address
)
14 pte
= (pte_t
*)__get_free_page(GFP_KERNEL
|__GFP_REPEAT
|__GFP_ZERO
);
16 __flush_page_to_ram(pte
);
17 flush_tlb_kernel_page(pte
);
24 static inline void pte_free_kernel(struct mm_struct
*mm
, pte_t
*pte
)
27 free_page((unsigned long) pte
);
30 static inline pgtable_t
pte_alloc_one(struct mm_struct
*mm
, unsigned long address
)
32 struct page
*page
= alloc_pages(GFP_KERNEL
|__GFP_REPEAT
|__GFP_ZERO
, 0);
39 __flush_page_to_ram(pte
);
40 flush_tlb_kernel_page(pte
);
43 pgtable_page_ctor(page
);
47 static inline void pte_free(struct mm_struct
*mm
, pgtable_t page
)
49 pgtable_page_dtor(page
);
50 cache_page(kmap(page
));
55 static inline void __pte_free_tlb(struct mmu_gather
*tlb
, pgtable_t page
,
56 unsigned long address
)
58 pgtable_page_dtor(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(struct mm_struct
*mm
, pmd_t
*pmd
)
72 return free_pointer_table(pmd
);
75 static inline int __pmd_free_tlb(struct mmu_gather
*tlb
, pmd_t
*pmd
,
76 unsigned long address
)
78 return free_pointer_table(pmd
);
82 static inline void pgd_free(struct mm_struct
*mm
, pgd_t
*pgd
)
84 pmd_free(mm
, (pmd_t
*)pgd
);
87 static inline pgd_t
*pgd_alloc(struct mm_struct
*mm
)
89 return (pgd_t
*)get_pointer_table();
93 static inline void pmd_populate_kernel(struct mm_struct
*mm
, pmd_t
*pmd
, pte_t
*pte
)
98 static inline void pmd_populate(struct mm_struct
*mm
, pmd_t
*pmd
, pgtable_t page
)
100 pmd_set(pmd
, page_address(page
));
102 #define pmd_pgtable(pmd) pmd_page(pmd)
104 static inline void pgd_populate(struct mm_struct
*mm
, pgd_t
*pgd
, pmd_t
*pmd
)
109 #endif /* _MOTOROLA_PGALLOC_H */