1 #ifndef _ASM_SCORE_PGALLOC_H
2 #define _ASM_SCORE_PGALLOC_H
5 #include <linux/highmem.h>
6 static inline void pmd_populate_kernel(struct mm_struct
*mm
, pmd_t
*pmd
,
9 set_pmd(pmd
, __pmd((unsigned long)pte
));
12 static inline void pmd_populate(struct mm_struct
*mm
, pmd_t
*pmd
,
15 set_pmd(pmd
, __pmd((unsigned long)page_address(pte
)));
18 #define pmd_pgtable(pmd) pmd_page(pmd)
20 static inline pgd_t
*pgd_alloc(struct mm_struct
*mm
)
24 ret
= (pgd_t
*) __get_free_pages(GFP_KERNEL
, PGD_ORDER
);
26 init
= pgd_offset(&init_mm
, 0UL);
27 pgd_init((unsigned long)ret
);
28 memcpy(ret
+ USER_PTRS_PER_PGD
, init
+ USER_PTRS_PER_PGD
,
29 (PTRS_PER_PGD
- USER_PTRS_PER_PGD
) * sizeof(pgd_t
));
35 static inline void pgd_free(struct mm_struct
*mm
, pgd_t
*pgd
)
37 free_pages((unsigned long)pgd
, PGD_ORDER
);
40 static inline pte_t
*pte_alloc_one_kernel(struct mm_struct
*mm
,
41 unsigned long address
)
45 pte
= (pte_t
*) __get_free_pages(GFP_KERNEL
|__GFP_REPEAT
|__GFP_ZERO
,
51 static inline struct page
*pte_alloc_one(struct mm_struct
*mm
,
52 unsigned long address
)
56 pte
= alloc_pages(GFP_KERNEL
| __GFP_REPEAT
, PTE_ORDER
);
60 if (!pgtable_page_ctor(pte
)) {
67 static inline void pte_free_kernel(struct mm_struct
*mm
, pte_t
*pte
)
69 free_pages((unsigned long)pte
, PTE_ORDER
);
72 static inline void pte_free(struct mm_struct
*mm
, pgtable_t pte
)
74 pgtable_page_dtor(pte
);
75 __free_pages(pte
, PTE_ORDER
);
78 #define __pte_free_tlb(tlb, pte, buf) \
80 pgtable_page_dtor(pte); \
81 tlb_remove_page((tlb), pte); \
84 #define check_pgt_cache() do {} while (0)
86 #endif /* _ASM_SCORE_PGALLOC_H */