Linux v2.6.16-rc1
[linux-2.6/next.git] / include / asm-m32r / pgalloc.h
blob6da309b6fda7faf3dd7927310753bea1da978531
1 #ifndef _ASM_M32R_PGALLOC_H
2 #define _ASM_M32R_PGALLOC_H
4 /* $Id$ */
6 #include <linux/config.h>
7 #include <linux/mm.h>
9 #include <asm/io.h>
11 #define pmd_populate_kernel(mm, pmd, pte) \
12 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte)))
14 static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
15 struct page *pte)
17 set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte)));
21 * Allocate and free page tables.
23 static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
25 pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
27 return pgd;
30 static __inline__ void pgd_free(pgd_t *pgd)
32 free_page((unsigned long)pgd);
35 static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
36 unsigned long address)
38 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
40 return pte;
43 static __inline__ struct page *pte_alloc_one(struct mm_struct *mm,
44 unsigned long address)
46 struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO);
49 return pte;
52 static __inline__ void pte_free_kernel(pte_t *pte)
54 free_page((unsigned long)pte);
57 static __inline__ void pte_free(struct page *pte)
59 __free_page(pte);
62 #define __pte_free_tlb(tlb, pte) pte_free((pte))
65 * allocating and freeing a pmd is trivial: the 1-entry pmd is
66 * inside the pgd, so has no extra memory associated with it.
67 * (In the PAE case we free the pmds as part of the pgd.)
70 #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
71 #define pmd_free(x) do { } while (0)
72 #define __pmd_free_tlb(tlb, x) do { } while (0)
73 #define pgd_populate(mm, pmd, pte) BUG()
75 #define check_pgt_cache() do { } while (0)
77 #endif /* _ASM_M32R_PGALLOC_H */